QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546757#4829. Mark on a Graphluqyou0 2ms7636kbC++141.2kb2024-09-04 13:03:422024-09-04 13:03:42

Judging History

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

  • [2024-09-04 13:03:42]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:7636kb
  • [2024-09-04 13:03:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pb push_back
const int maxn=1000+10;
int n,m,f[maxn][maxn],d[maxn];
void solve(){
    cin>>n>>m;
    for(int i=1,u,v;i<=m;i++) cin>>u>>v,f[u][v]=f[v][u]=1,d[u]++,d[v]++;
    int minn=1e9,mini=0;
    for(int i=1;i<=n;i++){
        if(d[i]<mini) mini=d[i],mini=i;
    } 
    int cnt=0;
    for(int i=1;i<=n;i++) cnt+=(d[i]==minn);
    if(minn==0&&cnt>=2) return cout<<"ok"<<endl,void();
    cout<<"mark"<<endl;
    cout<<5<<endl;
    for(int i=1;i<=n;i++){
        if(d[i]==2){
            for(int j=1;j<=n;j++){
                if(f[i][j]) cout<<i<<" "<<j<<endl;
            }
            break;
        }
    }
    for(int i=1;i<=n;i++){
        if(d[i]==3){
            for(int j=1;j<=n;j++){
                if(f[i][j]) cout<<i<<" "<<j<<endl;
            }
            break;
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}
/*
Samples
input:

output:

THINGS TODO:
检查freopen,尤其是后缀名
检查空间
检查调试语句是否全部注释
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 7636kb

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
40 124
40 1000
32 456
32 575
32 779

input:

1000 3555
330 666
121 222
601 501
689 190
446 441
754 49
669 385
656 559
715 437
383 905
483 252
598 16
956 593
24 54
250 209
627 75
597 520
897 500
182 369
777 855
414 363
25 676
920 889
83 725
688 603
282 329
102 326
725 759
694 449
119 87
199 956
199 600
547 272
221 163
749 581
583 858
937 748
87...

output:

mark
5
138 303
138 470
6 217
6 705
6 708

result:

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