QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#458520 | #8830. Breaking Bad | ucup-team3678# | TL | 0ms | 0kb | C++14 | 973b | 2024-06-29 17:45:09 | 2024-06-29 17:45:11 |
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 / n / n;
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: 0
Time Limit Exceeded
input:
2 0 4 4 0