# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
55985 |
2018-07-09T09:14:11 Z |
노영훈(#1562) |
Sushi (JOI16_sushi) |
C++11 |
|
661 ms |
21360 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=400010, inf=2e9;
int n, q;
int A[MX];
void solve1(){
for(int i=1; i<=n; i++) cin>>A[i];
for(int i=1; i<=q; i++){
int s, t, x; cin>>s>>t>>x;
for(int jj=s; jj<=t+n; jj++){
int j=(jj-1)%n+1;
if(x<A[j]) swap(x,A[j]);
if(j==t) break;
}
cout<<x<<'\n';
}
}
void solve2(){
set<int> S;
for(int i=1; i<=n; i++) cin>>A[i], S.insert(A[i]);
for(int i=1; i<=q; i++){
int s,t,x; cin>>s>>t>>x;
cout<<*S.rbegin()<<'\n';
S.erase(*S.rbegin());
S.insert(x);
}
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>q;
if(n*q<=1e8) solve1();
else solve2();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
376 KB |
Output is correct |
2 |
Correct |
16 ms |
484 KB |
Output is correct |
3 |
Correct |
15 ms |
484 KB |
Output is correct |
4 |
Correct |
14 ms |
576 KB |
Output is correct |
5 |
Correct |
13 ms |
576 KB |
Output is correct |
6 |
Correct |
14 ms |
632 KB |
Output is correct |
7 |
Correct |
14 ms |
704 KB |
Output is correct |
8 |
Correct |
15 ms |
812 KB |
Output is correct |
9 |
Correct |
14 ms |
812 KB |
Output is correct |
10 |
Correct |
15 ms |
812 KB |
Output is correct |
11 |
Correct |
15 ms |
812 KB |
Output is correct |
12 |
Correct |
17 ms |
812 KB |
Output is correct |
13 |
Correct |
22 ms |
812 KB |
Output is correct |
14 |
Correct |
26 ms |
812 KB |
Output is correct |
15 |
Correct |
21 ms |
812 KB |
Output is correct |
16 |
Correct |
4 ms |
812 KB |
Output is correct |
17 |
Correct |
3 ms |
812 KB |
Output is correct |
18 |
Correct |
2 ms |
812 KB |
Output is correct |
19 |
Correct |
3 ms |
812 KB |
Output is correct |
20 |
Correct |
2 ms |
812 KB |
Output is correct |
21 |
Correct |
3 ms |
812 KB |
Output is correct |
22 |
Correct |
3 ms |
812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
661 ms |
21360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
376 KB |
Output is correct |
2 |
Correct |
16 ms |
484 KB |
Output is correct |
3 |
Correct |
15 ms |
484 KB |
Output is correct |
4 |
Correct |
14 ms |
576 KB |
Output is correct |
5 |
Correct |
13 ms |
576 KB |
Output is correct |
6 |
Correct |
14 ms |
632 KB |
Output is correct |
7 |
Correct |
14 ms |
704 KB |
Output is correct |
8 |
Correct |
15 ms |
812 KB |
Output is correct |
9 |
Correct |
14 ms |
812 KB |
Output is correct |
10 |
Correct |
15 ms |
812 KB |
Output is correct |
11 |
Correct |
15 ms |
812 KB |
Output is correct |
12 |
Correct |
17 ms |
812 KB |
Output is correct |
13 |
Correct |
22 ms |
812 KB |
Output is correct |
14 |
Correct |
26 ms |
812 KB |
Output is correct |
15 |
Correct |
21 ms |
812 KB |
Output is correct |
16 |
Correct |
4 ms |
812 KB |
Output is correct |
17 |
Correct |
3 ms |
812 KB |
Output is correct |
18 |
Correct |
2 ms |
812 KB |
Output is correct |
19 |
Correct |
3 ms |
812 KB |
Output is correct |
20 |
Correct |
2 ms |
812 KB |
Output is correct |
21 |
Correct |
3 ms |
812 KB |
Output is correct |
22 |
Correct |
3 ms |
812 KB |
Output is correct |
23 |
Incorrect |
661 ms |
21360 KB |
Output isn't correct |
24 |
Halted |
0 ms |
0 KB |
- |