QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595580#6643. Graphs and ColorsUESTC_DECAYALI#WA 1ms3608kbC++20984b2024-09-28 14:02:452024-09-28 14:02:48

Judging History

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

  • [2024-09-28 14:02:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2024-09-28 14:02:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N = 105;
int edg[N][N];

void solve() {
    int n, k; cin >> n >> k;
    if (k>n/2) {
        cout << "NO\n"; return ;
    }

    for (int i=1; i<=n; ++i) for (int j=1; j<=n; ++j) edg[i][j] = 0;

    auto inv = [&](int a) {return n+1-a;};
    for (int c=1; c<=k; ++c) {
        edg[c][inv(c)] = c;
        for (int i=1; i<c; ++i) edg[c][inv(i)] = c, edg[i][inv(c)] = c;
        for (int i=c+1; i<=n/2; ++i) edg[c][i] = c, edg[inv(i)][inv(c)] = c;
    }
    
    if (n%2==1) {
        for (int i=1; i<=n/2; ++i) edg[i][(n+1)/2] = i, edg[(n+1)/2][inv(i)] = i;
    }

    cout << "YES\n";
    for (int i=2; i<=n; ++i) {
        for (int j=1; j<i; ++j) {
            if (edg[j][i]==0) edg[j][i] = 1;
            cout << edg[j][i] << ' ';
        }
        cout << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int t; cin >> t; while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3608kb

input:

768
8 24
7 20
17 61
17 76
16 100
16 16
15 59
9 17
14 31
14 61
10 32
17 55
5 7
10 29
14 82
13 47
17 32
5 10
16 76
14 59
8 28
13 19
12 41
13 41
11 32
11 53
3 2
16 52
16 87
7 12
9 15
15 65
15 53
17 47
6 15
12 1
14 35
16 60
12 31
14 70
15 88
12 2
8 23
12 38
16 111
16 117
5 4
14 90
12 55
15 41
15 48
15 4...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
1 
1 1 
1 1 1 
1 1 1 1 
1 1 1 1 1 
1 1 1 1 1 1 
1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 
NO
NO
NO
NO
NO
YES
1 
1 2 
1 2 1 
1 2 1 1 
1 2 1...

result:

wrong answer Integer parameter [name=col] equals to 5, violates the range [1, 4] (test case 52)