Submission #1010710

# Submission time Handle Problem Language Result Execution time Memory
1010710 2024-06-29T09:50:17 Z pcc Sushi (JOI16_sushi) C++17
5 / 100
12000 ms 6492 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

const int mxn = 4e5+10;
int arr[mxn];
int N,Q;

int main(){
	cin>>N>>Q;
	for(int i = 1;i<=N;i++)cin>>arr[i];
	while(Q--){
		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);
		}
		cout<<a<<'\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 7 ms 508 KB Output is correct
13 Correct 8 ms 512 KB Output is correct
14 Correct 6 ms 512 KB Output is correct
15 Correct 6 ms 348 KB Output is correct
16 Correct 4 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 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 436 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8130 ms 6472 KB Output is correct
2 Correct 7716 ms 4948 KB Output is correct
3 Correct 3987 ms 3000 KB Output is correct
4 Correct 8353 ms 6480 KB Output is correct
5 Correct 2895 ms 6492 KB Output is correct
6 Execution timed out 12053 ms 6332 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 7 ms 508 KB Output is correct
13 Correct 8 ms 512 KB Output is correct
14 Correct 6 ms 512 KB Output is correct
15 Correct 6 ms 348 KB Output is correct
16 Correct 4 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 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 436 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 8130 ms 6472 KB Output is correct
24 Correct 7716 ms 4948 KB Output is correct
25 Correct 3987 ms 3000 KB Output is correct
26 Correct 8353 ms 6480 KB Output is correct
27 Correct 2895 ms 6492 KB Output is correct
28 Execution timed out 12053 ms 6332 KB Time limit exceeded
29 Halted 0 ms 0 KB -