Task: | Pizzeriat |
Sender: | Yytsi |
Submission time: | 2018-01-14 20:55:38 +0200 |
Language: | C++ |
Status: | READY |
Result: | 11 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 11 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.06 s | 1 | details |
#2 | ACCEPTED | 0.04 s | 1 | details |
#3 | ACCEPTED | 0.06 s | 1 | details |
#4 | RUNTIME ERROR | 0.20 s | 2 | details |
#5 | RUNTIME ERROR | 0.24 s | 2 | details |
#6 | RUNTIME ERROR | 0.19 s | 2 | details |
#7 | RUNTIME ERROR | 0.18 s | 3 | details |
#8 | RUNTIME ERROR | 0.22 s | 3 | details |
#9 | RUNTIME ERROR | 0.21 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main(int, char**)': input/code.cpp:28:13: warning: unused variable 'x' [-Wunused-variable] int o, k, x; ^
Code
#include <iostream> using namespace std; #define N 1001 int p[N]; int n,q; int dist(int a, int b) { return abs(b - a); } int query(int k) { int h = 9999999; for (int i = 1; i <= n; i++) { int t = dist(k, i) + p[i]; h = min(h, t); } return h; } int main(int argc, char** argv) { ios_base::sync_with_stdio(0); cin >> n >> q;cin.ignore(); for (int i = 1; i <= n; i++) cin >> p[i]; cin.ignore(); for (int i = 0; i < q; i++) { int o, k, x; cin >> o; cin >> k; if (o == 1) { cin >> p[k]; } else { cout << query(k) << "\n"; } cin.ignore(); } return 0; }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
1000 1000 720 271 760 576 363 23 368 995... |
correct output |
---|
43 12 40 22 18 ... |
user output |
---|
43 12 40 22 18 ... |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
1000 1000 720 18 984 261 344 257 686 441... |
correct output |
---|
10 20 27 37 73 ... |
user output |
---|
10 20 27 37 73 ... |
Test 3
Group: 1
Verdict: ACCEPTED
input |
---|
1000 1000 120 764 890 848 949 59 894 916... |
correct output |
---|
24 25 13 16 19 ... |
user output |
---|
24 25 13 16 19 ... |
Test 4
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100000 100000 11763 43585 3126 3787 79765 64... |
correct output |
---|
284 143 346 203 157 ... |
user output |
---|
(empty) |
Test 5
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100000 100000 76947 78386 71190 65478 90345 ... |
correct output |
---|
459 297 128 234 204 ... |
user output |
---|
(empty) |
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100000 100000 39277 33504 98385 58115 28655 ... |
correct output |
---|
234 221 156 455 78 ... |
user output |
---|
(empty) |
Test 7
Group: 3
Verdict: RUNTIME ERROR
input |
---|
100000 100000 46508 6952 22836 54480 91235 2... |
correct output |
---|
427 409 352 39 388 ... |
user output |
---|
(empty) |
Test 8
Group: 3
Verdict: RUNTIME ERROR
input |
---|
100000 100000 15918 8771 36223 76330 39229 7... |
correct output |
---|
316 387 435 330 446 ... |
user output |
---|
(empty) |
Test 9
Group: 3
Verdict: RUNTIME ERROR
input |
---|
100000 100000 87734 39225 78667 43704 17207 ... |
correct output |
---|
228 83 176 428 273 ... |
user output |
---|
(empty) |