QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458520#8830. Breaking Baducup-team3678#TL 0ms0kbC++14973b2024-06-29 17:45:092024-06-29 17:45:11

Judging History

你现在查看的是最新测评结果

  • [2024-06-29 17:45:11]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-06-29 17:45:09]
  • 提交

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

output:


result: