QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#471446 | #7303. City United | Aria_Math | WA | 11ms | 8404kb | C++17 | 1.1kb | 2024-07-10 21:13:26 | 2024-07-10 21:13:27 |
Judging History
answer
// They say that life is always easier
// After you let yourself come undone
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 55;
const int K = 13;
const int M = 1594323;
int n, m, G[N][K], pre[14];
short f[N][M];
int main() {
//freopen("data.in", "r", stdin);
//freopen("code.out", "w", stdout);
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
for(int i = 1; i <= m; ++i) {
int u, v; cin >> u >> v;
if(u > v) swap(u, v);
G[v][v - u] = 1;
}
f[0][0] = 1;
for(int u = 1; u <= n; ++u)
for(int S = 0; S < M; ++S) if(f[u - 1][S]) {
int tmp = S;
for(int i = 1; i <= 13; ++i)
pre[i] = tmp % 3, tmp /= 3;
for(int x : {0, 1, 2}) {
pre[0] = x;
bool isOK = 1;
if(x) for(int i = 1; i <= 13; ++i)
if(G[u][u - i] && pre[i] && x != pre[i]) isOK = 0;
if(!isOK) continue;
int T = 0, now = 1;
for(int i = 0; i < 13; ++i)
T += pre[i] * now, now *= 3;
f[u][T] = (f[u][T] + f[u - 1][S]) & 3;
}
}
short ans = 0;
for(int S = 0; S < M; ++S)
ans = (ans + f[n][S]) & 3;
printf("%d\n", ans / 2);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 3764kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: -100
Wrong Answer
time: 11ms
memory: 8404kb
input:
15 31 9 5 14 5 2 7 5 15 11 14 11 9 2 6 3 4 12 1 6 8 3 5 11 10 15 6 4 1 1 2 8 9 6 12 14 10 13 2 4 5 3 8 3 15 11 6 7 5 4 6 11 2 13 15 3 2 8 4 6 13 7 10
output:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'