Task: | Zoo |
Sender: | ollpu |
Submission time: | 2019-03-07 16:30:32 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.02 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.02 s | details |
#4 | WRONG ANSWER | 0.09 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.02 s | details |
#7 | WRONG ANSWER | 0.03 s | details |
#8 | WRONG ANSWER | 0.02 s | details |
#9 | WRONG ANSWER | 0.04 s | details |
#10 | WRONG ANSWER | 0.04 s | details |
#11 | WRONG ANSWER | 0.06 s | details |
#12 | WRONG ANSWER | 0.06 s | details |
#13 | WRONG ANSWER | 0.44 s | details |
#14 | WRONG ANSWER | 0.44 s | details |
#15 | WRONG ANSWER | 0.32 s | details |
#16 | WRONG ANSWER | 0.57 s | details |
#17 | WRONG ANSWER | 0.58 s | details |
#18 | WRONG ANSWER | 0.56 s | details |
#19 | WRONG ANSWER | 0.57 s | details |
#20 | WRONG ANSWER | 0.03 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:63:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int coi = 0; coi < co[ci].size(); ++coi) { ~~~~^~~~~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; #define F first #define S second int dp[10000][1<<4]; int z[50000]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, c; cin >> n >> c; vector<bool> co[c]; vector<int> cow[c]; vector<int> ctm[n][2]; for (int i = 0; i < c; ++i) { int e, f, l; cin >> e >> f >> l; e--; for (int j = 0; j < f; ++j) { int x; cin >> x; x--; co[i].push_back(0); cow[i].push_back(x); ctm[x][0].push_back(i); } for (int j = 0; j < l; ++j) { int x; cin >> x; x--; co[i].push_back(1); cow[i].push_back(x); ctm[x][1].push_back(i); } } int res = 0; for (int sp = 0; sp < 1<<4; ++sp) { for (int i = 3; i < n; ++i) { for (int lp = 0; lp < 1<<4; ++lp) { dp[i][lp] = 0; } } for (int i = 0; i < c; ++i) z[i] = 0; int icc = 0; for (int j = 0; j < 4; ++j) { for (int ci : ctm[j][(sp >> j)&1]) { if (!z[ci]) { icc++; z[ci] = 1; } } } dp[3][sp] = icc; res = max(res, icc); for (int i = 4; i < n; ++i) { for (int lp = 0; lp < 1<<4; ++lp) { for (int pbit = 0; pbit < 1; ++pbit) { int pp = ((lp << 1)&15) | pbit; int gc = 0; for (int ci : ctm[i][lp>>3]) { if (z[ci]) continue; bool f = 1; for (int coi = 0; coi < co[ci].size(); ++coi) { int idx = cow[ci][coi]-(i-4); int bv = co[ci][coi]; if (idx >= 0 && idx < 4 && ((pp>>idx)&1) == bv) { f=0; break; } } gc += f; } dp[i][lp] = max(dp[i][lp], dp[i-1][pp]+gc); res = max(res, dp[i][lp]); } } } } cout << res << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
10 10 1 1 1 3 2 2 1 0 4 3 1 1 5 6 4 1 1 7 6 ... |
correct output |
---|
10 |
user output |
---|
10 |
Test 2
Verdict: WRONG ANSWER
input |
---|
10 12 2 0 1 2 4 2 2 5 7 4 6 4 0 1 6 4 2 2 5 8 6 7 ... |
correct output |
---|
12 |
user output |
---|
10 |
Test 3
Verdict: WRONG ANSWER
input |
---|
100 1000 1 0 1 2 1 0 1 3 1 1 0 5 1 1 0 1 ... |
correct output |
---|
628 |
user output |
---|
518 |
Test 4
Verdict: WRONG ANSWER
input |
---|
9999 49999 1 1 0 2 1 0 1 4 1 1 0 2 1 0 1 2 ... |
correct output |
---|
33706 |
user output |
---|
24865 |
Test 5
Verdict: WRONG ANSWER
input |
---|
10 60 1 3 0 2 3 4 1 0 1 2 1 1 3 1 2 4 5 1 0 3 3 4 5 ... |
correct output |
---|
58 |
user output |
---|
57 |
Test 6
Verdict: WRONG ANSWER
input |
---|
10 200 1 2 1 3 4 1 1 3 0 1 2 3 1 1 3 2 1 3 4 1 1 2 3 1 5 ... |
correct output |
---|
181 |
user output |
---|
177 |
Test 7
Verdict: WRONG ANSWER
input |
---|
80 300 1 0 2 4 5 1 2 0 1 2 2 4 1 2 4 5 6 3 3 4 1 3 4 5 6 7 ... |
correct output |
---|
294 |
user output |
---|
266 |
Test 8
Verdict: WRONG ANSWER
input |
---|
80 300 1 1 4 2 1 3 4 5 1 2 2 3 5 2 4 2 1 3 4 3 5 6 2 0 3 3 4 6 ... |
correct output |
---|
293 |
user output |
---|
263 |
Test 9
Verdict: WRONG ANSWER
input |
---|
125 1000 1 1 2 5 1 4 1 2 2 1 5 2 3 1 2 3 2 5 1 3 4 2 3 0 2 3 6 ... |
correct output |
---|
954 |
user output |
---|
875 |
Test 10
Verdict: WRONG ANSWER
input |
---|
125 1000 1 3 1 1 4 5 2 1 2 2 2 4 3 5 1 1 2 5 2 4 1 0 2 1 3 ... |
correct output |
---|
973 |
user output |
---|
878 |
Test 11
Verdict: WRONG ANSWER
input |
---|
931 2500 1 2 1 4 5 1 1 1 1 3 1 1 2 1 2 5 1 2 1 2 4 2 6 ... |
correct output |
---|
2489 |
user output |
---|
2177 |
Test 12
Verdict: WRONG ANSWER
input |
---|
931 2500 1 3 0 1 3 5 1 1 2 5 3 4 1 3 1 1 3 4 2 2 1 2 2 5 6 ... |
correct output |
---|
2495 |
user output |
---|
2183 |
Test 13
Verdict: WRONG ANSWER
input |
---|
1200 45731 1 4 1 1 3 4 5 2 1 1 1 4 5 1 0 3 2 4 5 1 0 4 1 2 4 5 ... |
correct output |
---|
41896 |
user output |
---|
39821 |
Test 14
Verdict: WRONG ANSWER
input |
---|
1200 45731 1 4 0 1 2 4 5 1 3 2 1 3 4 2 5 1 3 1 1 2 4 3 1 3 2 1 2 4 3 5 ... |
correct output |
---|
42038 |
user output |
---|
39778 |
Test 15
Verdict: WRONG ANSWER
input |
---|
9990 25000 1 1 4 4 1 2 3 5 1 3 2 2 3 4 1 5 1 2 2 3 4 1 2 1 0 3 1 2 4 ... |
correct output |
---|
24909 |
user output |
---|
21832 |
Test 16
Verdict: WRONG ANSWER
input |
---|
9990 49990 1 2 2 2 5 1 4 1 3 1 1 3 5 2 1 2 2 2 5 1 3 1 1 2 5 3 4 ... |
correct output |
---|
48994 |
user output |
---|
43616 |
Test 17
Verdict: WRONG ANSWER
input |
---|
9990 49990 1 2 1 1 3 2 1 1 1 3 5 1 1 2 4 1 2 1 1 2 2 1 3 ... |
correct output |
---|
49074 |
user output |
---|
43723 |
Test 18
Verdict: WRONG ANSWER
input |
---|
10000 50000 1 2 2 3 4 2 5 1 1 4 2 1 3 4 5 2 1 3 4 2 3 5 2 1 1 2 5 ... |
correct output |
---|
48996 |
user output |
---|
43570 |
Test 19
Verdict: WRONG ANSWER
input |
---|
10000 50000 1 3 0 1 2 3 1 3 1 2 3 4 5 1 1 3 1 2 4 5 2 2 3 4 5 2 3 6 ... |
correct output |
---|
49117 |
user output |
---|
43665 |
Test 20
Verdict: WRONG ANSWER
input |
---|
200 900 1 2 2 4 5 2 3 1 2 0 2 5 1 3 1 3 4 5 1 1 1 2 5 1 2 ... |
correct output |
---|
884 |
user output |
---|
769 |