QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323879#4829. Mark on a Graphhotboy27030 1ms3852kbC++141.6kb2024-02-10 13:59:012024-02-10 13:59:01

Judging History

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

  • [2024-02-10 13:59:01]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3852kb
  • [2024-02-10 13:59:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define pll pair <ll,ll>
#define fi first
#define se second
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1LL)
#define MASK(i) (1LL << (i))
ll n,m;
vector <ll> g[1010];
int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
    cin>>n>>m;
    vector <pll> edge;
    for (ll i = 1;i <= m;i ++){
        ll u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
        edge.push_back({u,v});
    }
    ll cnt[6];
    for (ll i = 1;i <= n;i ++){
        if (sz(g[i])<6)cnt[sz(g[i])]^=1;
    }
    if (cnt[0]+cnt[1]+cnt[2]+cnt[3]+cnt[4]!=0){
        cout<<"mark\n";
        vector <pll> del;
        for (ll i = 0;i < 5;i ++){
            ll sum = 0;
            for (ll j = 1;j <= n;j ++)sum += sz(g[j])==i;
            if (sum%2){
                bool ok = 0;
                for (ll j = 1;j <= n && !ok;j ++){
                    if (sz(g[j])==i+1){
                        for (auto x:g[j]){
                            if (sz(g[x])>i+1){
                                del.push_back({j,x});
                                ok = 1;
                                break;
                            }
                        }
                    }
                }
                assert(ok);
            }
        }
        cout<<sz(del)<<'\n';
        for (auto x:del)cout<<x.fi<<' '<<x.se<<'\n';
    }
    else{
        cout<<"ok";
    }
//    cout<<even<<'\n';
}


詳細信息

Test #1:

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

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
2
501 812
40 1000

input:

1000 3558
950 554
396 217
466 376
854 767
891 186
50 833
648 137
466 739
184 95
383 358
831 175
355 48
279 349
167 174
283 563
250 582
506 567
897 500
326 595
253 49
418 368
882 964
403 292
831 643
999 851
125 553
102 506
437 827
125 726
932 719
641 339
15 721
770 790
163 221
581 749
186 603
360 898...

output:

mark
2
138 470
19 257

result:

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