QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189924 | #3313. Emergency Evacuation | KKT89 | AC ✓ | 61ms | 5176kb | C++17 | 483b | 2023-09-28 01:32:44 | 2023-09-28 01:32:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int r,s,n; cin >> r >> s >> n;
// vector<int> cnt(r+s+2,0);
vector<int> v;
while(n--){
int x,y; cin >> x >> y;
y=(y<=s?y:s+1-(y-s));
// cnt[r-x+abs(s+1-y)]++;
v.push_back(r-x+abs(s+1-y)+1);
}
int res=0;
sort(v.rbegin(), v.rend());
for(int i=0;i<v.size();i++){
res=max(res,v[i]+i);
}
cout << res << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 58ms
memory: 5176kb
input:
500 500 475000 471 382 363 533 10 249 432 511 453 185 338 745 369 837 78 8 141 531 23 175 209 819 458 506 114 909 123 347 442 193 473 300 92 652 194 153 377 372 141 608 308 540 458 90 181 522 257 743 115 752 90 58 55 803 394 478 425 588 248 231 170 326 470 463 92 881 137 48 454 599 96 413 31 1000 29...
output:
475026
result:
ok single line: '475026'
Test #2:
score: 0
Accepted
time: 61ms
memory: 5140kb
input:
500 500 500000 200 367 499 822 451 305 102 514 337 592 383 600 314 158 287 989 325 827 447 266 133 698 96 851 229 284 259 954 174 110 431 15 51 45 187 770 485 793 17 478 121 668 8 675 60 500 288 732 180 627 260 666 222 640 128 14 154 824 92 522 37 748 297 47 122 952 436 24 414 527 385 339 290 52 275...
output:
500001
result:
ok single line: '500001'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
10 2 5 10 1 10 2 10 3 10 4 1 1
output:
12
result:
ok single line: '12'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
10 2 5 10 1 10 2 10 3 10 4 1 4
output:
12
result:
ok single line: '12'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
10 2 6 10 1 10 2 10 3 10 4 1 1 1 4
output:
13
result:
ok single line: '13'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
100 100 10000 39 51 21 136 45 179 36 129 3 155 20 127 49 135 7 140 3 127 3 139 21 102 8 196 37 191 27 89 16 78 15 14 3 140 18 149 33 84 17 33 19 120 29 74 47 17 2 20 34 26 27 84 40 114 3 8 12 43 39 28 8 142 12 171 39 147 44 46 36 46 44 73 15 23 1 190 32 8 18 145 16 93 22 74 21 47 21 73 3 157 1 114 2...
output:
10051
result:
ok single line: '10051'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
110 101 11332 47 179 25 17 48 73 31 96 4 69 10 10 24 17 44 160 55 27 19 60 44 78 22 27 28 185 32 47 2 58 3 175 1 84 47 117 17 44 12 93 33 132 2 115 53 135 9 19 49 130 50 201 45 24 25 179 29 43 38 20 7 68 14 135 10 169 46 68 54 48 5 153 35 95 37 10 26 102 11 145 42 103 52 199 5 129 11 112 45 57 6 190...
output:
11387
result:
ok single line: '11387'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
120 102 12729 2 68 13 194 6 33 14 56 53 77 12 9 7 134 36 172 40 98 14 143 61 175 56 6 20 132 37 10 61 166 34 186 60 18 17 45 20 90 7 63 17 22 1 108 27 115 29 181 13 162 45 12 28 136 39 77 46 149 35 177 42 200 9 157 35 140 17 95 50 55 41 149 61 128 1 163 15 175 29 183 16 96 47 55 34 108 31 11 23 202 ...
output:
12788
result:
ok single line: '12788'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
130 103 14193 39 106 23 78 32 179 57 124 67 161 15 81 12 199 33 52 50 103 51 199 31 173 35 150 31 81 60 8 29 205 38 4 50 9 62 127 9 41 29 27 60 19 52 150 4 128 69 21 64 42 54 78 2 182 54 121 29 127 32 87 15 199 63 145 21 169 30 25 28 117 37 161 10 116 48 1 64 155 54 47 55 55 13 135 20 43 27 55 45 5 ...
output:
14255
result:
ok single line: '14255'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
140 104 15724 59 191 12 75 23 89 15 197 69 91 3 93 48 9 58 149 9 179 58 34 11 78 41 166 62 151 61 63 10 104 21 199 15 184 30 85 50 152 21 72 42 52 54 8 19 73 18 143 19 86 3 161 73 10 16 152 66 171 30 106 72 112 59 102 8 139 34 152 19 152 22 30 11 107 11 135 66 196 35 13 26 185 14 89 54 167 55 164 45...
output:
15789
result:
ok single line: '15789'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3572kb
input:
150 105 17325 8 56 57 162 72 32 56 116 79 109 41 197 7 62 77 60 31 59 50 101 28 37 35 130 65 129 21 122 14 210 82 144 77 145 21 105 48 108 68 149 38 120 45 132 4 181 9 73 80 105 26 34 2 32 38 65 22 35 14 119 51 182 60 99 1 37 6 29 23 10 47 193 31 143 76 85 44 108 10 33 81 168 51 111 6 45 73 63 68 13...
output:
17393
result:
ok single line: '17393'
Test #12:
score: 0
Accepted
time: 3ms
memory: 3680kb
input:
160 106 18995 68 122 54 84 20 184 13 16 40 29 50 139 44 189 21 108 40 109 36 55 65 184 89 76 10 31 62 76 82 197 37 92 62 128 41 129 44 7 83 3 66 50 69 178 13 212 11 133 20 17 81 84 51 125 2 131 80 56 1 175 72 20 34 117 73 1 5 211 64 106 45 165 18 105 79 45 13 200 85 101 80 120 86 181 74 41 67 211 53...
output:
19066
result:
ok single line: '19066'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
170 107 20736 88 89 78 209 35 49 92 193 97 191 30 38 46 101 70 200 4 133 2 133 58 142 42 183 13 27 87 85 83 148 40 87 5 196 30 101 55 132 72 179 74 154 92 20 88 119 67 132 58 84 10 1 15 28 73 185 70 173 33 123 66 60 80 151 75 23 54 138 82 184 71 59 94 185 90 214 60 148 59 203 14 55 71 171 43 51 72 4...
output:
20810
result:
ok single line: '20810'
Test #14:
score: 0
Accepted
time: 4ms
memory: 3608kb
input:
180 108 22550 27 35 52 133 99 159 2 28 83 109 2 6 105 55 93 62 44 157 47 116 100 208 62 144 86 41 24 196 76 206 62 68 8 210 12 23 94 142 79 133 26 90 35 199 57 45 55 12 13 102 6 154 75 48 93 179 1 43 59 118 44 104 74 189 11 55 100 122 9 100 88 181 90 45 83 60 47 200 66 182 74 5 40 39 1 21 80 120 23 ...
output:
22627
result:
ok single line: '22627'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
190 109 24437 67 165 27 190 57 194 54 170 37 155 39 41 41 78 100 94 2 47 92 117 24 52 29 136 73 13 41 2 27 205 111 116 42 29 17 21 79 129 28 39 105 77 109 108 15 57 110 199 61 26 13 12 18 215 59 93 22 77 2 23 6 8 51 81 92 134 85 67 101 162 105 159 84 74 82 169 56 69 89 107 35 75 53 199 99 213 2 53 1...
output:
24516
result:
ok single line: '24516'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
5 2 7 1 1 1 2 1 3 2 3 2 4 4 4 5 2
output:
9
result:
ok single line: '9'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
500 500 16 1 1 1 2 1 999 1 1000 2 1 2 2 2 999 2 1000 3 1 3 2 3 999 3 1000 499 500 499 501 499 999 499 1000
output:
1008
result:
ok single line: '1008'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
300 300 1 300 100
output:
202
result:
ok single line: '202'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
300 300 1 300 400
output:
101
result:
ok single line: '101'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 1 1 1 1
output:
2
result:
ok single line: '2'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
1 1 1 1 2
output:
2
result:
ok single line: '2'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
1 1 2 1 1 1 2
output:
3
result:
ok single line: '3'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
300 300 1800 3 351 1 173 3 100 3 518 3 34 2 428 1 247 3 92 3 436 1 188 1 515 2 442 2 453 1 341 2 370 2 378 3 290 3 225 2 107 2 69 2 195 2 79 3 542 2 200 3 11 3 299 1 308 1 443 3 82 2 422 3 549 2 461 3 235 1 196 1 157 2 8 2 333 1 288 2 198 2 599 1 383 2 247 2 322 2 592 1 6 2 253 1 174 1 113 2 293 3 4...
output:
2098
result:
ok single line: '2098'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
300 300 1 99 584
output:
486
result:
ok single line: '486'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
300 300 1 143 91
output:
368
result:
ok single line: '368'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
300 300 1 8 547
output:
540
result:
ok single line: '540'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
300 300 1 81 302
output:
222
result:
ok single line: '222'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
300 300 1 103 476
output:
374
result:
ok single line: '374'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
300 300 1 105 142
output:
355
result:
ok single line: '355'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
300 300 1 148 478
output:
331
result:
ok single line: '331'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
300 300 1 30 497
output:
468
result:
ok single line: '468'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
300 300 1 59 116
output:
427
result:
ok single line: '427'