# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392682 | 2021-04-21T13:33:39 Z | Ruxandra985 | Teams (CEOI11_tea) | C++14 | 2500 ms | 76316 KB |
#include <bits/stdc++.h> #define DIMN 1000010 using namespace std; int dp[DIMN]; int mp[DIMN]; pair <int , int> v[DIMN]; int main() { FILE *fin = stdin; FILE *fout = stdout; int n , i , now , st , dr , mid , cnt; 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); for (i = 1 ; i <= n ; i++){ if (i - v[i].first < 0){ dp[i] = -2000000000; mp[i] = mp[i - 1]; } else { dp[i] = mp[i - v[i].first] + 1; mp[i] = max(mp[i - 1] , dp[i]); } } fprintf (fout,"%d\n" , dp[n]); now = n; while (now){ /// nu pare o idee buna ce fac.... st = v[now].first; dr = now; while (st <= dr){ mid = (st + dr) / 2; if (mp[now - mid] + 1 != dp[now]) /// nu e bun st = mid + 1; else dr = mid - 1; } /// solutia e in dr (ultimul care se poate) fprintf (fout,"%d " , st); for (i = 1 ; i <= st ; i++ , now--){ fprintf (fout,"%d ",v[now].second); } fprintf (fout,"\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Execution timed out | 2578 ms | 55748 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 436 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2555 ms | 54756 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2578 ms | 55656 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2569 ms | 55564 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2518 ms | 55452 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2573 ms | 57396 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2562 ms | 70548 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2519 ms | 75236 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2564 ms | 76316 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |