# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557547 | 2022-05-05T12:56:50 Z | 600Mihnea | Food Court (JOI21_foodcourt) | C++17 | 1000 ms | 14384 KB |
#include <bits/stdc++.h> bool home = 1; using namespace std; ///#define int long long typedef long long ll; int n,m,q; signed main() { #ifdef ONLINE_JUDGE home = 0; #endif home=0; if (home) { freopen("I_am_iron_man", "r", stdin); } else { ios::sync_with_stdio(0); cin.tie(0); } cin>>n>>m>>q; vector<vector<ll>> questions; vector<int> sol; for (int i=1;i<=q;i++) { int type; cin>>type; assert(1<=type&&type<=3); questions.push_back(vector<ll> (5-type)); if(type==3)sol.push_back(-1); for (auto &qu:questions.back()) cin>>qu; } for(int i=1;i<=n;i++) { vector<pair<ll, int>> ev; ll have=0; ll jump=0; int id=-1; for (auto &question:questions) { int type=5-(int)question.size(); assert(1<=type&&type<=3); id+=(type==3); if(type==1) { int l=question[0],r=question[1],group=question[2],k=question[3]; if(l<=i&&i<=r) { have+=k; ev.push_back({have, group}); } } if (type==2) { int l=question[0],r=question[1],k=question[2]; if (l<=i&&i<=r) { jump=min(have,jump+k); } } if(type==3) { int a=question[0]; ll b=question[1]; if (a==i) { b+=jump; if (b>have) { sol[id]=0; }else{ int low=0,high=(int) ev.size()-1,pz=-1; while (low<=high) { int mid=(low+high)/2; if(ev[mid].first>=b) { pz=mid; high=mid-1; }else{ low=mid+1; } } assert(pz!=-1); sol[id]=ev[pz].second; } } } } } for (auto &x:sol) { cout<<x<<"\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 21 ms | 460 KB | Output is correct |
3 | Correct | 17 ms | 428 KB | Output is correct |
4 | Correct | 20 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 21 ms | 472 KB | Output is correct |
8 | Correct | 20 ms | 572 KB | Output is correct |
9 | Correct | 18 ms | 468 KB | Output is correct |
10 | Correct | 18 ms | 476 KB | Output is correct |
11 | Correct | 18 ms | 476 KB | Output is correct |
12 | Correct | 19 ms | 468 KB | Output is correct |
13 | Correct | 14 ms | 448 KB | Output is correct |
14 | Correct | 20 ms | 476 KB | Output is correct |
15 | Correct | 16 ms | 432 KB | Output is correct |
16 | Correct | 20 ms | 472 KB | Output is correct |
17 | Correct | 11 ms | 444 KB | Output is correct |
18 | Correct | 26 ms | 468 KB | Output is correct |
19 | Correct | 12 ms | 452 KB | Output is correct |
20 | Correct | 12 ms | 460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 21 ms | 460 KB | Output is correct |
3 | Correct | 17 ms | 428 KB | Output is correct |
4 | Correct | 20 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 21 ms | 472 KB | Output is correct |
8 | Correct | 20 ms | 572 KB | Output is correct |
9 | Correct | 18 ms | 468 KB | Output is correct |
10 | Correct | 18 ms | 476 KB | Output is correct |
11 | Correct | 18 ms | 476 KB | Output is correct |
12 | Correct | 19 ms | 468 KB | Output is correct |
13 | Correct | 14 ms | 448 KB | Output is correct |
14 | Correct | 20 ms | 476 KB | Output is correct |
15 | Correct | 16 ms | 432 KB | Output is correct |
16 | Correct | 20 ms | 472 KB | Output is correct |
17 | Correct | 11 ms | 444 KB | Output is correct |
18 | Correct | 26 ms | 468 KB | Output is correct |
19 | Correct | 12 ms | 452 KB | Output is correct |
20 | Correct | 12 ms | 460 KB | Output is correct |
21 | Correct | 18 ms | 452 KB | Output is correct |
22 | Correct | 16 ms | 456 KB | Output is correct |
23 | Correct | 13 ms | 468 KB | Output is correct |
24 | Correct | 18 ms | 524 KB | Output is correct |
25 | Correct | 1 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 18 ms | 468 KB | Output is correct |
28 | Correct | 18 ms | 468 KB | Output is correct |
29 | Correct | 18 ms | 508 KB | Output is correct |
30 | Correct | 18 ms | 524 KB | Output is correct |
31 | Correct | 19 ms | 388 KB | Output is correct |
32 | Correct | 20 ms | 468 KB | Output is correct |
33 | Correct | 16 ms | 504 KB | Output is correct |
34 | Correct | 20 ms | 520 KB | Output is correct |
35 | Correct | 14 ms | 468 KB | Output is correct |
36 | Correct | 21 ms | 460 KB | Output is correct |
37 | Correct | 7 ms | 340 KB | Output is correct |
38 | Correct | 11 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1089 ms | 4196 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 14384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 21 ms | 460 KB | Output is correct |
3 | Correct | 17 ms | 428 KB | Output is correct |
4 | Correct | 20 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 21 ms | 472 KB | Output is correct |
8 | Correct | 20 ms | 572 KB | Output is correct |
9 | Correct | 18 ms | 468 KB | Output is correct |
10 | Correct | 18 ms | 476 KB | Output is correct |
11 | Correct | 18 ms | 476 KB | Output is correct |
12 | Correct | 19 ms | 468 KB | Output is correct |
13 | Correct | 14 ms | 448 KB | Output is correct |
14 | Correct | 20 ms | 476 KB | Output is correct |
15 | Correct | 16 ms | 432 KB | Output is correct |
16 | Correct | 20 ms | 472 KB | Output is correct |
17 | Correct | 11 ms | 444 KB | Output is correct |
18 | Correct | 26 ms | 468 KB | Output is correct |
19 | Correct | 12 ms | 452 KB | Output is correct |
20 | Correct | 12 ms | 460 KB | Output is correct |
21 | Execution timed out | 1089 ms | 4196 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 4280 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 21 ms | 460 KB | Output is correct |
3 | Correct | 17 ms | 428 KB | Output is correct |
4 | Correct | 20 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 21 ms | 472 KB | Output is correct |
8 | Correct | 20 ms | 572 KB | Output is correct |
9 | Correct | 18 ms | 468 KB | Output is correct |
10 | Correct | 18 ms | 476 KB | Output is correct |
11 | Correct | 18 ms | 476 KB | Output is correct |
12 | Correct | 19 ms | 468 KB | Output is correct |
13 | Correct | 14 ms | 448 KB | Output is correct |
14 | Correct | 20 ms | 476 KB | Output is correct |
15 | Correct | 16 ms | 432 KB | Output is correct |
16 | Correct | 20 ms | 472 KB | Output is correct |
17 | Correct | 11 ms | 444 KB | Output is correct |
18 | Correct | 26 ms | 468 KB | Output is correct |
19 | Correct | 12 ms | 452 KB | Output is correct |
20 | Correct | 12 ms | 460 KB | Output is correct |
21 | Correct | 18 ms | 452 KB | Output is correct |
22 | Correct | 16 ms | 456 KB | Output is correct |
23 | Correct | 13 ms | 468 KB | Output is correct |
24 | Correct | 18 ms | 524 KB | Output is correct |
25 | Correct | 1 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 18 ms | 468 KB | Output is correct |
28 | Correct | 18 ms | 468 KB | Output is correct |
29 | Correct | 18 ms | 508 KB | Output is correct |
30 | Correct | 18 ms | 524 KB | Output is correct |
31 | Correct | 19 ms | 388 KB | Output is correct |
32 | Correct | 20 ms | 468 KB | Output is correct |
33 | Correct | 16 ms | 504 KB | Output is correct |
34 | Correct | 20 ms | 520 KB | Output is correct |
35 | Correct | 14 ms | 468 KB | Output is correct |
36 | Correct | 21 ms | 460 KB | Output is correct |
37 | Correct | 7 ms | 340 KB | Output is correct |
38 | Correct | 11 ms | 468 KB | Output is correct |
39 | Execution timed out | 1089 ms | 4196 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 340 KB | Output is correct |
2 | Correct | 21 ms | 460 KB | Output is correct |
3 | Correct | 17 ms | 428 KB | Output is correct |
4 | Correct | 20 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 21 ms | 472 KB | Output is correct |
8 | Correct | 20 ms | 572 KB | Output is correct |
9 | Correct | 18 ms | 468 KB | Output is correct |
10 | Correct | 18 ms | 476 KB | Output is correct |
11 | Correct | 18 ms | 476 KB | Output is correct |
12 | Correct | 19 ms | 468 KB | Output is correct |
13 | Correct | 14 ms | 448 KB | Output is correct |
14 | Correct | 20 ms | 476 KB | Output is correct |
15 | Correct | 16 ms | 432 KB | Output is correct |
16 | Correct | 20 ms | 472 KB | Output is correct |
17 | Correct | 11 ms | 444 KB | Output is correct |
18 | Correct | 26 ms | 468 KB | Output is correct |
19 | Correct | 12 ms | 452 KB | Output is correct |
20 | Correct | 12 ms | 460 KB | Output is correct |
21 | Correct | 18 ms | 452 KB | Output is correct |
22 | Correct | 16 ms | 456 KB | Output is correct |
23 | Correct | 13 ms | 468 KB | Output is correct |
24 | Correct | 18 ms | 524 KB | Output is correct |
25 | Correct | 1 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 468 KB | Output is correct |
27 | Correct | 18 ms | 468 KB | Output is correct |
28 | Correct | 18 ms | 468 KB | Output is correct |
29 | Correct | 18 ms | 508 KB | Output is correct |
30 | Correct | 18 ms | 524 KB | Output is correct |
31 | Correct | 19 ms | 388 KB | Output is correct |
32 | Correct | 20 ms | 468 KB | Output is correct |
33 | Correct | 16 ms | 504 KB | Output is correct |
34 | Correct | 20 ms | 520 KB | Output is correct |
35 | Correct | 14 ms | 468 KB | Output is correct |
36 | Correct | 21 ms | 460 KB | Output is correct |
37 | Correct | 7 ms | 340 KB | Output is correct |
38 | Correct | 11 ms | 468 KB | Output is correct |
39 | Execution timed out | 1089 ms | 4196 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |