Task: | Pizzeriat |
Sender: | Ilmari2000 |
Submission time: | 2018-01-14 19:42:35 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | 1 | details |
#2 | WRONG ANSWER | 0.04 s | 1 | details |
#3 | WRONG ANSWER | 0.03 s | 1 | details |
#4 | TIME LIMIT EXCEEDED | -- | 2 | details |
#5 | TIME LIMIT EXCEEDED | -- | 2 | details |
#6 | TIME LIMIT EXCEEDED | -- | 2 | details |
#7 | TIME LIMIT EXCEEDED | -- | 3 | details |
#8 | TIME LIMIT EXCEEDED | -- | 3 | details |
#9 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'void recalc(std::vector<int>&, std::vector<int>&, int)': input/code.cpp:10:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < prices.size(); i++) ^
Code
#include <cmath> #include <climits> #include <iostream> #include <vector> using namespace std; void recalc(vector<int> &prices, vector<int> &cheapest, int p) { for(int i = 0; i < prices.size(); i++) { int np = abs(i - p) + prices[p]; if(np < cheapest[i]) cheapest[i] = np; } } int main() { int n, k; cin >> n >> k; vector<int> prices, cheapest; prices.resize(n); cheapest.resize(n, INT_MAX); for(int i = 0; i < n; i++) cin >> prices[i]; for(int i = 0; i < n; i++) recalc(prices, cheapest, i); for(int i = 0; i < k; i++) { int t; cin >> t; if(t == 1) { int a, b; cin >> a >> b; prices[a - 1] = b; recalc(prices, cheapest, a - 1); } if(t == 2) { int a; cin >> a; cout << cheapest[a - 1] << endl; } } }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1000 1000 720 271 760 576 363 23 368 995... |
correct output |
---|
43 12 40 22 18 ... |
user output |
---|
43 12 15 22 18 ... |
Test 2
Group: 1
Verdict: WRONG ANSWER
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: WRONG ANSWER
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: TIME LIMIT EXCEEDED
input |
---|
100000 100000 11763 43585 3126 3787 79765 64... |
correct output |
---|
284 143 346 203 157 ... |
user output |
---|
(empty) |
Test 5
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 76947 78386 71190 65478 90345 ... |
correct output |
---|
459 297 128 234 204 ... |
user output |
---|
(empty) |
Test 6
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 39277 33504 98385 58115 28655 ... |
correct output |
---|
234 221 156 455 78 ... |
user output |
---|
(empty) |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 46508 6952 22836 54480 91235 2... |
correct output |
---|
427 409 352 39 388 ... |
user output |
---|
(empty) |
Test 8
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 15918 8771 36223 76330 39229 7... |
correct output |
---|
316 387 435 330 446 ... |
user output |
---|
(empty) |
Test 9
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 87734 39225 78667 43704 17207 ... |
correct output |
---|
228 83 176 428 273 ... |
user output |
---|
(empty) |