| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 392742 | Ruxandra985 | Teams (CEOI11_tea) | C++14 | 424 ms | 39536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define DIMN 1000010
using namespace std;
int dp[DIMN];
int mp[DIMN];
int tt[DIMN];
int w[DIMN] , poz[DIMN];
pair <int , int> v[DIMN];
int main()
{
FILE *fin = stdin;
FILE *fout = stdout;
int n , i , now , st , dr , mid , elem , a , b;
fscanf (fin,"%d",&n);
for (i = 1 ; i <= n ; i++){
fscanf (fin,"%d",&v[i].first);
v[i].second = i;
}
sort (v + 1 , v + n + 1);
elem = 0;
for (i = 1 ; i <= n ; i++){
if (i - v[i].first < 0){
dp[i] = -2000000000;
mp[i] = mp[i - 1];
tt[i] = -1;
}
else {
dp[i] = mp[i - v[i].first] + 1;
w[++elem] = i;
poz[i] = elem;
tt[i] = i - v[i].first;
mp[i] = max(mp[i - 1] , dp[i]);
}
}
fprintf (fout,"%d\n" , dp[n]);
now = n;
int maxi = now - tt[now];
while (now){ /// nu pare o idee buna ce fac....
a = max(0 , now - maxi); /// ma asigur ca v2 nu e -1
/// cea mai mica echipa posibila ar fi de v[now].first
b = now - v[now].first;
while (tt[b] == -1)
b--;
/// a <= b
if (a > b)
swap(a , b);
a = poz[a];
b = poz[b];
st = a;
dr = b;
while (st <= dr){
mid = (st + dr)/2;
if (dp[w[mid]] + 1 == dp[now])
dr = mid - 1;
else st = mid + 1;
}
fprintf (fout,"%d " , now - w[st]);
maxi = max(maxi , now - w[st]);
while (now > w[st]){
fprintf (fout,"%d ",v[now].second);
now--;
}
fprintf (fout,"\n");
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
