QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#127648#6643. Graphs and ColorsoreoioiwyWA 1ms3872kbC++171.8kb2023-07-19 21:35:002023-07-19 21:35:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 21:35:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3872kb
  • [2023-07-19 21:35:00]
  • 提交

answer

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

typedef long long ll;

// #define tpyeinput int
// inline char nc() {static char buf[1000000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;}
// inline void read(tpyeinput &sum) {char ch=nc();sum=0;while(!(ch>='0'&&ch<='9')) ch=nc();while(ch>='0'&&ch<='9') sum=(sum<<3)+(sum<<1)+(ch-48),ch=nc();}

template<typename T>
void read(T &x) {
    int f = 1;
    x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-')f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + (ch ^ 48);
        ch = getchar();
    }
    x *= f;
}

const int N = 1e2+10, M = 2*N;
int g[N][N], col[N][N];

void solve() {
    int n, k;
    read(n); read(k);
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            g[i][j] = col[i][j] = 0;
        }
    }
    if(k > n/2) {
        puts("NO");
        return;
    }
    for(int i = 1; i <= n/2; i++) {
        col[2*i-1][2*i] = i;
    }
    for(int i = 1; i <= n/2; i++) {
        for(int j = i+1; j <= n/2; j++) {
            col[2*i-1][2*j-1] = col[2*i][2*j] = i;
            col[2*j-1][2*i-1] = col[2*j][2*i] = i;
            col[2*i-1][2*j] = col[2*i][2*j-1] = j;
            col[2*j][2*i-1] = col[2*j-1][2*i] = j;
        }
    }
    if(n&1) {
        for(int i = 1; i <= n-1; i++) {
            col[i][n] = col[n][i] = (i+1)/2;
        }
    }
    puts("YES");
    for(int i = 1; i < n; i++) {
        for(int j = 1; j <= i; j++) {
            printf("%d ", col[j][i+1]);
        }
        puts("");
    }
}

int main() {
#ifdef LOCAL_TEST
    freopen("test.in", "r", stdin);
#endif
    int times = 1;
    read(times);
    while(times--) {
        solve();   
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 2 
2 1 2 
1 3 2 3 
3 1 3 2 3 
1 4 2 4 3 4 
4 1 4 2 4 3 4 
1 5 2 5 3 5 4 5 
5 1 5 2 5 3 5 4 5 
1 6 2 6 3 6 4 6 5 6 
6 1 6 2 6 3 6 4 6 5 6 
NO
NO
NO
NO
NO
YES
1 
1 2 
2 1 2 
1 3 2 3 
3 1 3...

result:

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