# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
392674 | Ruxandra985 | Teams (CEOI11_tea) | C++14 | 20 ms | 424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define DIMN 5010
using namespace std;
struct idk{
int ech , ok , sz , fth;
} dp[DIMN];
pair <int , int> v[DIMN];
int main()
{
FILE *fin = stdin;
FILE *fout = stdout;
int n , i , j , now;
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);
dp[0].ok = 1;
for (i = 1 ; i <= n ; i++){
for (j = i - v[i].first ; j >= 0 ; j--){
if (!dp[j].ok)
continue;
if (dp[j].ech + 1 > dp[i].ech){
dp[i].ech = dp[j].ech + 1;
dp[i].ok = 1;
dp[i].sz = max(i - j , dp[j].sz);
dp[i].fth = j;
}
else if (dp[j].ech + 1 == dp[i].ech && max(i - j , dp[j].sz) < dp[i].sz){
dp[i].ech = dp[j].ech + 1;
dp[i].ok = 1;
dp[i].sz = max(i - j , dp[j].sz);
dp[i].fth = j;
}
}
}
fprintf (fout,"%d\n" , dp[n].ech);
now = n;
while (now){
fprintf (fout,"%d ", now - dp[now].fth);
for (i = now ; i > dp[now].fth ; i--)
fprintf (fout,"%d ",v[i].second);
fprintf (fout,"\n");
now = dp[now].fth;
}
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... |