# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1010725 |
2024-06-29T10:02:36 Z |
pcc |
Sushi (JOI16_sushi) |
C++17 |
|
12000 ms |
6688 KB |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
const int mxn = 4e5+10;
int arr[mxn];
int N,Q;
int ans[mxn];
int ptr = 0;
int main(){
cin>>N>>Q;
for(int i = 1;i<=N;i++)cin>>arr[i];
for(int j = 0;j<Q;j++){
int l,r,a;
cin>>l>>r>>a;
if(l>r){
for(int i = l;i<=N;i++)if(arr[i]>a)swap(a,arr[i]);
for(int i = 1;i<=r;i++)if(arr[i]>a)swap(a,arr[i]);
}
else{
for(int i = l;i<=r;i++)if(arr[i]>a)swap(arr[i],a);
}
ans[ptr++] = a;
}
for(int i = 0;i<Q;i++)cout<<ans[i]<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
3 ms |
348 KB |
Output is correct |
11 |
Correct |
5 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
13 |
Correct |
6 ms |
456 KB |
Output is correct |
14 |
Correct |
4 ms |
344 KB |
Output is correct |
15 |
Correct |
4 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
440 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9139 ms |
6584 KB |
Output is correct |
2 |
Correct |
8090 ms |
5176 KB |
Output is correct |
3 |
Correct |
3199 ms |
3152 KB |
Output is correct |
4 |
Correct |
9659 ms |
6688 KB |
Output is correct |
5 |
Execution timed out |
12084 ms |
6212 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
3 ms |
348 KB |
Output is correct |
11 |
Correct |
5 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
13 |
Correct |
6 ms |
456 KB |
Output is correct |
14 |
Correct |
4 ms |
344 KB |
Output is correct |
15 |
Correct |
4 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
440 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
9139 ms |
6584 KB |
Output is correct |
24 |
Correct |
8090 ms |
5176 KB |
Output is correct |
25 |
Correct |
3199 ms |
3152 KB |
Output is correct |
26 |
Correct |
9659 ms |
6688 KB |
Output is correct |
27 |
Execution timed out |
12084 ms |
6212 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |