QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#182431#6643. Graphs and Colorsucup-team134WA 1ms3764kbC++142.0kb2023-09-18 00:25:122023-09-18 00:25:12

Judging History

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

  • [2023-09-18 00:25:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3764kb
  • [2023-09-18 00:25:12]
  • 提交

answer

#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
typedef pair<int,int> pii;

const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}

const int maxn=110;

int adj[maxn][maxn];

void build(int n){

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

    if(n%2==0){

        for(int i=1;i<=n/2;i++){

            int nd=n/2+i;

            adj[i][nd]=i;
            adj[nd][i]=i;

            for(int j=1;j<=n/2;j++){
                adj[i][n/2+j]=i;
                adj[n/2+j][i]=i;

                adj[nd][j]=i;
                adj[j][nd]=i;
            }

        }

    }
    else{
        n--;
        for(int i=1;i<=n/2;i++){

            int nd=n/2+i;

            adj[i][nd]=i;
            adj[nd][i]=i;

            adj[i][n+1]=i;
            adj[n+1][i]=i;
            adj[nd][n+1]=i;
            adj[n+1][nd]=i;

            for(int j=1;j<=n/2;j++){
                adj[i][n/2+j]=i;
                adj[n/2+j][i]=i;

                adj[nd][j]=i;
                adj[j][nd]=i;
            }

        }

    }

}

int main(){


    ///freopen("test.txt","r",stdin);

    int t;
    scanf("%d",&t);
    while(t--){

        int n,k;
        scanf("%d %d",&n,&k);

        build(n);
        if(k>n/2){
            printf("NO\n");
            continue;
        }
        printf("YES\n");
        for(int i=2;i<=n;i++){
            for(int j=1;j<i;j++){
                printf("%d ",max(1,min(k,adj[i][j])) );
            }
            printf("\n");
        }

    }


    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 1 
1 1 1 
1 1 1 1 
1 1 1...

result:

wrong answer Graph is not correct (test case 52)