QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#458523 | #8830. Breaking Bad | ucup-team3678# | TL | 316ms | 3868kb | C++14 | 991b | 2024-06-29 17:45:46 | 2024-06-29 17:45:47 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int N = 1005;
int a[N][N], p[N];
bool b[30];
signed main() {
int n; scanf("%d", &n);
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
scanf("%d", &a[i][j]);
}
for (int j = 1; j <= n; ++j) p[j] = j;
mt19937 rnd;
const int T = 800 * 1000 * 1000 / max(n, 10) / max(n, 10);
for (int i = 1; i <= T; ++i) {
shuffle(p + 1, p + n + 1, rnd);
int S = 0;
for (int j = 1; j <= n; ++j) S += a[j][p[j]];
S = S % 5 + 10;
b[S] = 1;
for (int j = 1; j <= n; ++j) {
for (int k = j + 1; k <= n; ++k) {
b[S - a[j][p[j]] - a[k][p[k]] + a[j][p[k]] + a[k][p[j]]] = 1;
}
}
}
for (int i = 0; i < 5; ++i) {
bool t = 0;
for (int j = i; j < 30; j += 5) t |= b[j];
putchar("NY"[t]);
}
puts("");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 104ms
memory: 3812kb
input:
2 0 4 4 0
output:
YNNYN
result:
ok "YNNYN"
Test #2:
score: 0
Accepted
time: 106ms
memory: 3748kb
input:
2 1 1 1 1
output:
NNYNN
result:
ok "NNYNN"
Test #3:
score: 0
Accepted
time: 315ms
memory: 3868kb
input:
4 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0
output:
YYYYN
result:
ok "YYYYN"
Test #4:
score: 0
Accepted
time: 316ms
memory: 3616kb
input:
4 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0
output:
YYYYN
result:
ok "YYYYN"
Test #5:
score: -100
Time Limit Exceeded
input:
10 1 4 2 0 0 2 0 1 3 3 0 3 1 4 4 1 4 0 2 2 1 4 2 0 0 2 0 1 0 3 0 3 1 4 4 1 4 0 2 2 4 2 0 3 3 0 3 4 1 1 2 0 3 1 1 3 1 2 4 4 4 2 0 3 3 0 3 4 1 1 2 0 3 1 1 3 1 2 4 4 1 4 2 0 0 2 0 1 3 3 3 1 4 2 2 4 2 3 0 0