Task: | Pinopeli |
Sender: | ollpu |
Submission time: | 2018-01-18 16:29:25 +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.04 s | 1 | details |
#2 | ACCEPTED | 0.04 s | 1 | details |
#3 | ACCEPTED | 0.04 s | 1 | details |
#4 | WRONG ANSWER | 0.03 s | 1 | details |
#5 | WRONG ANSWER | 0.05 s | 1 | details |
#6 | WRONG ANSWER | 0.04 s | 1 | details |
#7 | ACCEPTED | 0.05 s | 1 | details |
#8 | ACCEPTED | 0.04 s | 1 | details |
#9 | ACCEPTED | 0.03 s | 1 | details |
#10 | ACCEPTED | 0.05 s | 1 | details |
#11 | ACCEPTED | 0.05 s | 1 | details |
#12 | WRONG ANSWER | 0.04 s | 1 | details |
#13 | WRONG ANSWER | 0.05 s | 1 | details |
#14 | WRONG ANSWER | 0.04 s | 1 | details |
#15 | WRONG ANSWER | 0.04 s | 1 | details |
#16 | WRONG ANSWER | 0.06 s | 1 | details |
#17 | WRONG ANSWER | 0.05 s | 1 | details |
#18 | WRONG ANSWER | 0.05 s | 1 | details |
#19 | WRONG ANSWER | 0.05 s | 1 | details |
#20 | ACCEPTED | 0.04 s | 1 | details |
#21 | WRONG ANSWER | 0.04 s | 1 | details |
#22 | WRONG ANSWER | 0.05 s | 1 | details |
#23 | WRONG ANSWER | 0.04 s | 1 | details |
#24 | WRONG ANSWER | 0.05 s | 1 | details |
#25 | ACCEPTED | 0.04 s | 1 | details |
#26 | WRONG ANSWER | 0.05 s | 1 | details |
#27 | WRONG ANSWER | 0.06 s | 1 | details |
#28 | WRONG ANSWER | 0.05 s | 1 | details |
#29 | WRONG ANSWER | 0.05 s | 1 | details |
#30 | WRONG ANSWER | 0.06 s | 1 | details |
#31 | WRONG ANSWER | 0.04 s | 1 | details |
#32 | WRONG ANSWER | 0.05 s | 1 | details |
#33 | WRONG ANSWER | 0.05 s | 1 | details |
#34 | WRONG ANSWER | 0.05 s | 1 | details |
#35 | WRONG ANSWER | 0.05 s | 1 | details |
#36 | WRONG ANSWER | 0.05 s | 1 | details |
#37 | TIME LIMIT EXCEEDED | -- | 2 | details |
#38 | TIME LIMIT EXCEEDED | -- | 2 | details |
#39 | TIME LIMIT EXCEEDED | -- | 2 | details |
#40 | ACCEPTED | 0.04 s | 2 | details |
#41 | TIME LIMIT EXCEEDED | -- | 2 | details |
#42 | TIME LIMIT EXCEEDED | -- | 2 | details |
#43 | TIME LIMIT EXCEEDED | -- | 2 | details |
#44 | TIME LIMIT EXCEEDED | -- | 2 | details |
#45 | ACCEPTED | 0.04 s | 2 | details |
#46 | TIME LIMIT EXCEEDED | -- | 2 | details |
#47 | TIME LIMIT EXCEEDED | -- | 3 | details |
#48 | TIME LIMIT EXCEEDED | -- | 3 | details |
#49 | TIME LIMIT EXCEEDED | -- | 3 | details |
#50 | TIME LIMIT EXCEEDED | -- | 3 | details |
#51 | RUNTIME ERROR | 0.93 s | 3 | details |
#52 | TIME LIMIT EXCEEDED | -- | 3 | details |
#53 | TIME LIMIT EXCEEDED | -- | 3 | details |
#54 | RUNTIME ERROR | 0.90 s | 3 | details |
#55 | TIME LIMIT EXCEEDED | -- | 3 | details |
#56 | TIME LIMIT EXCEEDED | -- | 3 | details |
#57 | RUNTIME ERROR | 0.97 s | 3 | details |
#58 | RUNTIME ERROR | 0.68 s | 3 | details |
#59 | RUNTIME ERROR | 0.83 s | 3 | details |
#60 | RUNTIME ERROR | 1.00 s | 3 | details |
#61 | RUNTIME ERROR | 0.89 s | 3 | details |
Compiler report
input/code.cpp: In function 'int h(std::map<int, int>, bool)': input/code.cpp:50:9: warning: 'art' may be used uninitialized in this function [-Wmaybe-uninitialized] if (art) stc[p.F-i]--; ^
Code
#include <iostream> #include <map> #include <unordered_map> #include <vector> using namespace std; #define F first #define S second string stfy(map<int, int> &st) { string s; for (auto p : st) { s += to_string(p.first); s += ":"; s += to_string(p.second); s += ";"; } return s; } unordered_map<string, int> cc; int N, A; int TAKE_x, TAKE_y, KEEP; vector<pair<int, int>> ADDs; int y(map<int, int>&, vector<int>&, vector<pair<int, int>>&, int, bool); int h(map<int, int> st, bool vr = 0) { if (st.size() == 0) return 0; string s = stfy(st); if (cc.count(s)) return cc[s]; for (auto p : st) { map<int, int> stc = st; stc[p.F]--; if (stc[p.F] == 0) stc.erase(p.F); for (int i = 1; i <= p.F; ++i) { bool art; if (i != p.F) { art = stc.count(p.F-i); stc[p.F-i]++; } vector<int> sz; for (auto p2 : stc) { for (int j = 0; j < p2.S; ++j) sz.push_back(p2.F); } vector<pair<int, int>> ha; if (y(stc, sz, ha, i, vr)) { if (vr) { TAKE_x = p.F; TAKE_y = i; } return 1; } if (i != p.F) { if (art) stc[p.F-i]--; else stc.erase(p.F-i); } } } return 0; } int y(map<int, int> &st, vector<int> &sz, vector<pair<int, int>> &ha, int lf, bool vr) { if (lf == 0 || ha.size() == sz.size()) { if (ha.size() == sz.size() && lf > A) return 0; map<int, int> stc = st; for (auto p : ha) { stc[p.F]--; if (stc[p.F] == 0) stc.erase(p.F); stc[p.F+p.S]++; } bool W = !h(move(stc)); if (W && vr) { KEEP = lf; } return W; } for (int i = 0; i < lf; ++i) { ha.push_back({sz[ha.size()], i}); if (y(st, sz, ha, lf-i, vr)) { if (vr) ADDs.push_back({sz[ha.size()], i}); return 1; } ha.pop_back(); } return 0; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N >> A; map<int, int> bg; for (int i = 0; i < N; ++i) { int x; cin >> x; bg[x]++; } bool W = h(bg, 1); if (W) { cout << "YES\n"; cout << "TAKE " << TAKE_x << " " << TAKE_y << endl; for (auto p : ADDs) { if (p.S) cout << "ADD " << p.F << " " << p.S << '\n'; } cout << "KEEP " << KEEP << endl; } else cout << "NO" << endl; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 1 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
2 1 1 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 3
Group: 1
Verdict: ACCEPTED
input |
---|
1 1 2 |
correct output |
---|
NO |
user output |
---|
NO |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 1 1 1 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 1 2 1 |
correct output |
---|
YES TAKE 2 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 6
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 1 3 |
correct output |
---|
YES TAKE 3 1 KEEP 1 END |
user output |
---|
YES TAKE 3 1 KEEP 1 |
Test 7
Group: 1
Verdict: ACCEPTED
input |
---|
4 1 1 1 1 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 8
Group: 1
Verdict: ACCEPTED
input |
---|
3 1 2 1 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 9
Group: 1
Verdict: ACCEPTED
input |
---|
2 1 2 2 |
correct output |
---|
NO |
user output |
---|
NO |
Test 10
Group: 1
Verdict: ACCEPTED
input |
---|
2 1 3 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 11
Group: 1
Verdict: ACCEPTED
input |
---|
1 1 4 |
correct output |
---|
NO |
user output |
---|
NO |
Test 12
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 1 1 1 1 1 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 13
Group: 1
Verdict: WRONG ANSWER
input |
---|
4 1 2 1 1 1 |
correct output |
---|
YES TAKE 2 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 14
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 1 2 2 1 |
correct output |
---|
YES TAKE 2 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 15
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 1 2 3 |
correct output |
---|
YES TAKE 3 1 KEEP 1 END |
user output |
---|
YES TAKE 2 1 KEEP 1 |
Test 16
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 1 3 1 1 |
correct output |
---|
YES TAKE 3 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 17
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 1 4 1 |
correct output |
---|
YES TAKE 4 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 18
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 1 5 |
correct output |
---|
YES TAKE 5 1 KEEP 1 END |
user output |
---|
YES TAKE 5 1 KEEP 1 |
Test 19
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 2 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 20
Group: 1
Verdict: ACCEPTED
input |
---|
2 2 1 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 21
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 2 2 |
correct output |
---|
YES TAKE 2 2 KEEP 2 END |
user output |
---|
YES TAKE 2 2 KEEP 2 |
Test 22
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 2 1 1 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 23
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 2 2 1 |
correct output |
---|
YES TAKE 2 2 KEEP 1 ADD 0 1 END |
user output |
---|
YES TAKE 2 1 KEEP 1 |
Test 24
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 2 3 |
correct output |
---|
YES TAKE 3 3 KEEP 1 ADD 0 1 ADD 0 1 ... |
user output |
---|
NO |
Test 25
Group: 1
Verdict: ACCEPTED
input |
---|
4 2 1 1 1 1 |
correct output |
---|
NO |
user output |
---|
NO |
Test 26
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 2 2 1 1 |
correct output |
---|
YES TAKE 2 2 KEEP 2 END |
user output |
---|
YES TAKE 2 2 KEEP 2 |
Test 27
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 2 2 2 |
correct output |
---|
NO |
user output |
---|
YES TAKE 2 2 ADD 0 1 KEEP 1 |
Test 28
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 2 3 1 |
correct output |
---|
YES TAKE 3 3 KEEP 2 ADD 0 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 29
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 2 4 |
correct output |
---|
YES TAKE 4 4 KEEP 2 ADD 0 1 ADD 0 1 ... |
user output |
---|
YES TAKE 4 1 KEEP 1 |
Test 30
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 2 1 1 1 1 1 |
correct output |
---|
YES TAKE 1 1 KEEP 1 END |
user output |
---|
YES TAKE 1 1 KEEP 1 |
Test 31
Group: 1
Verdict: WRONG ANSWER
input |
---|
4 2 2 1 1 1 |
correct output |
---|
YES TAKE 2 2 KEEP 1 ADD 0 1 END |
user output |
---|
YES TAKE 2 1 KEEP 1 |
Test 32
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 2 2 2 1 |
correct output |
---|
YES TAKE 2 2 KEEP 1 ADD 1 1 END |
user output |
---|
NO |
Test 33
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 2 2 3 |
correct output |
---|
YES TAKE 3 3 KEEP 1 ADD 0 2 END |
user output |
---|
YES TAKE 2 2 KEEP 2 |
Test 34
Group: 1
Verdict: WRONG ANSWER
input |
---|
3 2 3 1 1 |
correct output |
---|
YES TAKE 3 3 KEEP 1 ADD 0 1 ADD 0 1 ... |
user output |
---|
NO |
Test 35
Group: 1
Verdict: WRONG ANSWER
input |
---|
2 2 4 1 |
correct output |
---|
YES TAKE 4 4 KEEP 1 ADD 0 1 ADD 0 1 ... |
user output |
---|
YES TAKE 4 4 ADD 0 2 KEEP 2 |
Test 36
Group: 1
Verdict: WRONG ANSWER
input |
---|
1 2 5 |
correct output |
---|
YES TAKE 5 5 KEEP 1 ADD 0 2 ADD 0 2 ... |
user output |
---|
YES TAKE 5 2 KEEP 2 |
Test 37
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
6 1 5 2 3 1 6 3 |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 38
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 1 1 2 3 4 5 |
correct output |
---|
YES TAKE 5 1 KEEP 1 END |
user output |
---|
(empty) |
Test 39
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
7 1 2 2 2 2 2 2 5 |
correct output |
---|
YES TAKE 5 1 KEEP 1 END |
user output |
---|
(empty) |
Test 40
Group: 2
Verdict: ACCEPTED
input |
---|
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
NO |
user output |
---|
NO |
Test 41
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 1 7 7 2 2 |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 42
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
6 2 5 2 3 1 6 3 |
correct output |
---|
YES TAKE 6 6 KEEP 2 ADD 3 2 ADD 2 1 ... |
user output |
---|
(empty) |
Test 43
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 3 1 2 3 4 5 |
correct output |
---|
YES TAKE 5 5 KEEP 1 ADD 3 1 ADD 1 1 ... |
user output |
---|
(empty) |
Test 44
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
7 5 2 2 2 2 2 2 5 |
correct output |
---|
YES TAKE 5 5 KEEP 1 ADD 0 2 ADD 0 2 ... |
user output |
---|
(empty) |
Test 45
Group: 2
Verdict: ACCEPTED
input |
---|
20 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
NO |
user output |
---|
NO |
Test 46
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 4 7 7 2 2 |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 47
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 1 489 402 131 79 196 338 319 1 2... |
correct output |
---|
YES TAKE 500 1 KEEP 1 END |
user output |
---|
(empty) |
Test 48
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 1 222 9 263 104 241 286 306 4 35... |
correct output |
---|
YES TAKE 498 1 KEEP 1 END |
user output |
---|
(empty) |
Test 49
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 1 102 275 66 352 310 448 152 19 ... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 50
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 1 62 458 377 166 75 238 345 76 1... |
correct output |
---|
YES TAKE 500 1 KEEP 1 END |
user output |
---|
(empty) |
Test 51
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 1 206 409 99 306 53 351 188 463 ... |
correct output |
---|
YES TAKE 498 1 KEEP 1 END |
user output |
---|
(empty) |
Test 52
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 468 280 36 405 277 160 440 276 63 ... |
correct output |
---|
YES TAKE 498 498 KEEP 2 ADD 494 2 ADD 492 2 ... |
user output |
---|
(empty) |
Test 53
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 298 32 22 455 427 85 483 397 391 2... |
correct output |
---|
YES TAKE 500 500 KEEP 2 ADD 496 4 ADD 493 1 ... |
user output |
---|
(empty) |
Test 54
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 294 162 263 109 294 201 81 66 278 ... |
correct output |
---|
YES TAKE 500 500 KEEP 2 ADD 499 1 ADD 495 2 ... |
user output |
---|
(empty) |
Test 55
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 102 15 57 414 4 390 362 236 250 98... |
correct output |
---|
YES TAKE 499 499 KEEP 2 ADD 492 3 ADD 491 1 ... |
user output |
---|
(empty) |
Test 56
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 336 170 375 337 6 248 262 286 304 ... |
correct output |
---|
YES TAKE 498 498 KEEP 2 ADD 494 2 ADD 490 4 ... |
user output |
---|
(empty) |
Test 57
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 209 5 390 188 108 124 385 390 380 ... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 58
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 217 102 116 309 329 245 174 94 358... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 59
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 218 366 422 444 234 247 152 122 44... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 60
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 207 275 384 115 426 47 451 426 272... |
correct output |
---|
NO |
user output |
---|
(empty) |
Test 61
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 400 33 243 65 284 436 139 334 284 ... |
correct output |
---|
NO |
user output |
---|
(empty) |