# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164454 | 2019-11-20T17:14:10 Z | Lawliet | Cake (CEOI14_cake) | C++14 | 2000 ms | 3972 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 250010; const int INF = 1000000010; int n, p, q; int v[MAXN]; int ans[MAXN]; void rebuild() { int L = p - 1; int R = p + 1; int curTime = 0; ans[ p ] = curTime++; while( L != 0 || R != n + 1 ) { if( v[ L ] < v[ R ] ) ans[ L-- ] = curTime++; else ans[ R++ ] = curTime++; } } int main() { scanf("%d %d",&n,&p); v[ 0 ] = v[ n + 1 ] = INF; for(int i = 1 ; i <= n ; i++) scanf("%d",&v[i]); rebuild(); scanf("%d",&q); for(int i = 1 ; i <= q ; i++) { char a; int pos; scanf(" %c %d",&a,&pos); if( a == 'F' ) printf("%d\n",ans[ pos ]); if( a == 'E' ) { int newD; scanf("%d",&newD); for(int j = 1 ; j <= n ; j++) if( v[pos] < v[j] && v[j] <= n - newD + 1 ) v[j]--; v[ pos ] = n - newD + 1; rebuild(); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 17 ms | 376 KB | Output is correct |
5 | Correct | 273 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2045 ms | 1192 KB | Time limit exceeded |
2 | Execution timed out | 2066 ms | 1400 KB | Time limit exceeded |
3 | Execution timed out | 2058 ms | 1272 KB | Time limit exceeded |
4 | Execution timed out | 2065 ms | 1144 KB | Time limit exceeded |
5 | Execution timed out | 2045 ms | 1064 KB | Time limit exceeded |
6 | Execution timed out | 2054 ms | 1148 KB | Time limit exceeded |
7 | Execution timed out | 2058 ms | 1116 KB | Time limit exceeded |
8 | Execution timed out | 2049 ms | 1060 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 98 ms | 2428 KB | Output is correct |
2 | Correct | 64 ms | 2424 KB | Output is correct |
3 | Correct | 63 ms | 2296 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 163 ms | 3684 KB | Output is correct |
6 | Correct | 151 ms | 3972 KB | Output is correct |
7 | Correct | 106 ms | 3568 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 427 ms | 1064 KB | Output is correct |
2 | Correct | 705 ms | 1192 KB | Output is correct |
3 | Execution timed out | 2061 ms | 1528 KB | Time limit exceeded |
4 | Execution timed out | 2058 ms | 1708 KB | Time limit exceeded |
5 | Correct | 848 ms | 1560 KB | Output is correct |
6 | Execution timed out | 2058 ms | 1780 KB | Time limit exceeded |
7 | Execution timed out | 2064 ms | 1508 KB | Time limit exceeded |
8 | Execution timed out | 2057 ms | 1784 KB | Time limit exceeded |
9 | Execution timed out | 2059 ms | 2936 KB | Time limit exceeded |
10 | Execution timed out | 2062 ms | 1868 KB | Time limit exceeded |
11 | Execution timed out | 2054 ms | 1296 KB | Time limit exceeded |
12 | Execution timed out | 2060 ms | 2424 KB | Time limit exceeded |
13 | Execution timed out | 2041 ms | 2672 KB | Time limit exceeded |