Submission #264553

# Submission time Handle Problem Language Result Execution time Memory
264553 2020-08-14T07:38:49 Z 반딧불(#5094) Teams (CEOI11_tea) C++17
0 / 100
2500 ms 62228 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
pair<int, int> arr[10002];
int DP[10002], DP2[10002];
int track[10002];

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        int x;
        scanf("%d", &x);
        arr[i] = {x, i};
    }

    sort(arr+1, arr+n+1);
    DP2[0] = -1000000000;
    for(int i=1; i<=n; i++){
        for(int j=0; j<=i-arr[i].first; j++){
            if(DP[i] < DP[j]+1 || (DP[i] == DP[j]+1 && DP2[i] > max(DP2[j], i-j))){
                DP[i] = DP[j]+1, DP2[i] = max(DP2[j], i-j);
                track[i] = j;
            }
        }
    }

    printf("%d\n", DP[n]);
    while(n){
        printf("%d ", n - track[n]);
        for(int i=track[n]+1; i<=n; i++) printf("%d ", arr[i].second);
        puts("");
        n = track[n];
    }
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
tea.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Expected EOF
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Expected EOF
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Expected EOF
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 512 KB Expected EOF
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 512 KB Expected EOF
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 640 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2587 ms 62228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 640 KB Expected EOF
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -