# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975877 |
2024-05-06T01:48:53 Z |
Darren0724 |
Cake (CEOI14_cake) |
C++17 |
|
2000 ms |
3212 KB |
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
//#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e9;
int32_t main() {
LCBorz;
int n,c;cin>>n>>c;
vector<int> v(n);
vector<int> ans(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
auto cal=[&]()->void {
int l=c-2,r=c;
for(int i=1;i<n;i++){
if(r==n||v[l]<v[r]){
ans[l--]=i;
}
else{
ans[r++]=i;
}
}
};
cal();
int q;cin>>q;
for(int i=0;i<q;i++){
char c;cin>>c;
if(c=='F'){
int p;cin>>p;
cout<<ans[p-1]<<endl;
}
else{
int a,b;cin>>a>>b;a--;
b=n+1-b;
int k=v[a];
for(int j=0;j<n;j++){
if(v[j]>=k&&v[j]<=b)v[j]--;
}
v[a]=b;
cal();
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2028 ms |
504 KB |
Time limit exceeded |
2 |
Execution timed out |
2100 ms |
512 KB |
Time limit exceeded |
3 |
Execution timed out |
2031 ms |
764 KB |
Time limit exceeded |
4 |
Execution timed out |
2053 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
2049 ms |
604 KB |
Time limit exceeded |
6 |
Execution timed out |
2035 ms |
600 KB |
Time limit exceeded |
7 |
Execution timed out |
2029 ms |
628 KB |
Time limit exceeded |
8 |
Execution timed out |
2040 ms |
604 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
1624 KB |
Output is correct |
2 |
Incorrect |
32 ms |
1564 KB |
Output isn't correct |
3 |
Incorrect |
30 ms |
1616 KB |
Output isn't correct |
4 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
5 |
Incorrect |
106 ms |
3212 KB |
Output isn't correct |
6 |
Correct |
83 ms |
2900 KB |
Output is correct |
7 |
Incorrect |
59 ms |
2716 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
306 ms |
564 KB |
Execution killed with signal 6 |
2 |
Correct |
504 ms |
592 KB |
Output is correct |
3 |
Execution timed out |
2033 ms |
1108 KB |
Time limit exceeded |
4 |
Execution timed out |
2013 ms |
924 KB |
Time limit exceeded |
5 |
Runtime error |
620 ms |
848 KB |
Execution killed with signal 6 |
6 |
Execution timed out |
2033 ms |
1232 KB |
Time limit exceeded |
7 |
Execution timed out |
2043 ms |
1004 KB |
Time limit exceeded |
8 |
Execution timed out |
2031 ms |
1368 KB |
Time limit exceeded |
9 |
Execution timed out |
2044 ms |
2648 KB |
Time limit exceeded |
10 |
Execution timed out |
2003 ms |
1680 KB |
Time limit exceeded |
11 |
Execution timed out |
2021 ms |
928 KB |
Time limit exceeded |
12 |
Execution timed out |
2057 ms |
1884 KB |
Time limit exceeded |
13 |
Execution timed out |
2050 ms |
2644 KB |
Time limit exceeded |