QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665450#4829. Mark on a Graphsongziyan0 0ms36784kbC++141.1kb2024-10-22 12:56:482024-10-22 12:56:50

Judging History

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

  • [2024-10-22 12:56:50]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:36784kb
  • [2024-10-22 12:56:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
// char buf[1<<22],*p1,*p2;
// #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1==p2)?0:*p1++)
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch))f=(ch=='-')?-1:1,ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x*f;
}
const int N=5005;
int n,m,u[N],v[N],g[N][N];
int pu[5],pv[5],vis[N][N];
signed main(){
    mt19937 rnd(998244353);
    n=read();m=read();
    for(int i=1;i<=m;i++){
        u[i]=read(),v[i]=read();
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    }
    for(int i=0;i<5;i++){
        int a=rnd()%n+1,b=rnd()%n+1;
        while(vis[a][b]||a==b){
            a=rnd()%n+1,b=rnd()%n+1;
        }
        pu[i]=a;pv[i]=b;
        vis[a][b]=vis[b][a]=1;
    }
    int flg=1;
    for(int i=0;i<5;i++)flg&=g[pu[i]][pv[i]];
    if(flg){puts("ok");return 0;}
    puts("mark");
    int cnt=0;
    for(int i=0;i<5;i++)if(!g[pu[i]][pv[i]])++cnt;
    printf("%lld\n",cnt);
    for(int i=0;i<5;i++)if(!g[pu[i]][pv[i]])printf("%lld %lld\n",pu[i],pv[i]);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 36784kb

input:

1000 3560
603 151
415 20
102 569
895 552
678 734
24 614
689 518
440 223
751 919
223 433
711 551
502 634
706 583
812 501
514 535
780 751
720 530
532 384
888 139
864 791
292 675
171 881
30 592
464 557
280 299
654 650
894 335
250 532
792 10
83 969
118 771
579 300
852 983
243 940
957 939
817 889
911 319...

output:

mark
5
641 568
147 145
397 742
723 518
880 633

input:

1000 3565
626 311
882 830
665 298
534 33
682 582
50 833
155 683
656 183
184 217
392 381
450 259
63 633
335 355
770 790
640 763
707 250
950 401
224 873
974 302
521 246
368 520
794 262
113 49
643 831
715 526
95 125
440 102
70 757
464 840
11 36
355 37
232 687
178 201
182 394
201 34
951 583
221 937
257 ...

output:

mark
5
641 568
147 145
397 742
723 518
880 633

result:

wrong answer Token "mark" doesn't correspond to pattern "ok"