QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323037#4829. Mark on a GraphPentagonal0 2ms4320kbC++175.7kb2024-02-08 11:16:242024-02-08 11:16:25

Judging History

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

  • [2024-02-08 11:16:25]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:4320kb
  • [2024-02-08 11:16:24]
  • 提交

answer

// #pragma GCC target("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimization ("Ofast")
//#pragma GCC -Wnarrowing

//Template {
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>
using namespace std;
using namespace __gnu_pbds;
 
//IO templates
//Note: use endl only for interactive problems or to debug segfaults; use newl for other problems
#define newl "\n"
#define fastIO ios::sync_with_stdio(false); cin.tie(nullptr)
#define fileIO(x) ifstream fin((str) x + (str) ".in"); ofstream fout((str) x + (str) ".out");
// void fileIO(string x) {}
#define flush() fflush(stdout)
#define interact(n) fflush(stdout); cin >> n; if (n == -1) return 0
#define testcases int tt; cin >> tt; fun (i, tt) solve();

#define edgeIO(m) fun (i, m) {int a, b; cin >> a >> b; addEdges(a, b);}
#define WeightedEdgeIO(m) fun (i, m) {int a, b, c; cin >> a >> b >> c; addWeightedEdges(a, b, c);}
#define numberedEdgeIO(m) fun (i, m) {int a, b; cin >> a >> b; addWeightedEdges(a, b, i);}
//types
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define ld long double
#define str string
#define boolean bool
#define String string
 
//vector
#define pb push_back
#define append push_back
 
//pairs
#define mp make_pair
#define p2 pair<int, int>
#define p3 pair<int, p2>
#define m3(x, y, z) mp(x, mp(y, z))
#define ich first
#define ni second.first
#define sanshi second.second
 
//For loops
#define ahegao(i, a, b) for (int i = a; i < b; i++)
#define baka(i, b, a) for (int i = b; i > a; i--)
#define fun(i, n) for (int i = 1; i <= (n); (i)++)
#define fon(i, n) for (int i = 0; i < (n); (i)++)
#define fur(i, n) for (auto i : (n))
#define oniichan(i, n) for (auto &i : (n))
 
//Sorts
#define sz(aaa) ((signed) aaa.size())
// #define len(aaa) ((signed) aaa.size())
#define all(a) a.begin(), a.end()
#define Sort(a) sort((a).begin(), (a).end())
#define rSort(a) sort((a).rbegin(), (a).rend())
#define clamp(x, y) (x) = min((int) (x), (int) (y))
#define CLAMP(x, y) (x) = max((int) (x), (int) (y))
 
//Other stuff
#define pqueue priority_queue
#define elif else if
#define addEdges(a, b) adj[a].pb(b); adj[b].pb(a)
#define addWeightedEdges(a, b, c) adj[a].pb(mp(b, c)); adj[b].pb(mp(a, c))
// #define find find_by_order
#define printLength(x) if (x < INF) cout << x << newl; else cout << -1 << newl;
// #define printVector(a) fur (i, a) cout << i << ' '; cout << newl;
void printVector(vector<int> DontUseThisName) {
    fur (i, DontUseThisName) cout << i << ' '; cout << newl;
}
void printVector(vector<p2> DontUseThisName) {
    fur (i, DontUseThisName) cout << i.first << ' ' << i.second << newl; cout << newl;
}
void printVector(vector<vector<int>> DontUseThisName) {
    fur (i, DontUseThisName) printVector(i); cout << newl;
}
ll max(ll a, signed b) {return max(a, (ll) b);}
ll max(signed a, ll b) {return max((ll) a, b);}

void pv(int a) {cout << a << newl;}
void pv(int a, int b) {printVector({a, b});}
void pv(p2 a) {printVector({a.first, a.second});};
void pv(int a, int b, int c) {printVector({a, b, c});}
void pv(int a, int b, int c, int d) {printVector({a, b, c, d});}
void pv(int a, int b, int c, int d, int e) {printVector({a, b, c, d, e});}
void pv(int a, int b, int c, int d, int e, int f) {printVector({a, b, c, d, e, f});}
// void pv(int a, )
// void printVector(vector<char> DontUseThisName) {
//     fur (i, DontUseThisName) cout << i << ' '; cout << newl;
// }
// void printRange(vector<int>::iterator Left, vector<int>::iterator Right) {
//     for (auto i = Left; i < Right; i++) cout << *i << ' ';
//     cout << newl;
// } 
//Constants
// const int MOD =  1e9+7; // 998244353
// const int SMALLMOD = 998244353;
const int INF = 2e9+1337;
const ll EXCEED = 2e18+1337;
const ll GRAVITY = 8e18;

//#define vectorIO(n, MikuBondage) fun (j, n) {int i; cin >> i; MikuBondage.pb(i);}
void vectorIO(int n, vector<int> &DontUseThisName) {
    fun (j, n) {int i; cin >> i; DontUseThisName.pb(i);}
}
//#define vector2IO(n, MikuBondage) fun (j, n) {int i, ii; cin >> i >> ii; MikuBondage.pb(mp(i, ii));}
void vector2IO(int n, vector<p2> &DontUseThisName) {
    fun (j, n) {int i, ii; cin >> i >> ii; DontUseThisName.pb(mp(i, ii));}
}

// const int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
#define shortest_path_queue priority_queue<p2, vector<p2>, greater<p2>>
#define printArray(DontUseThisName, NakedLolisGalore, GenshinImpactClimbing) ahegao (j, NakedLolisGalore, GenshinImpactClimbing + 1) cout << DontUseThisName[j] << ' '; cout << newl;
#define print2dArray(SplitComplexProblemsIntoMultipleParts, ScuteSwarm, GenshinImpactClimbing) fun (i, ScuteSwarm) {fun (j, GenshinImpactClimbing) cout << SplitComplexProblemsIntoMultipleParts[i][j] << ' '; cout << newl;}
//}
const int MAX = 1003;
const int MOD = 2003;
int n, m, k, curr;
set<int> adj[MAX];
vector<int> MikuBondage;
vector<p2> dxd;
bool check(int a, int b) {
    return sz(adj[a]) > sz(adj[b]);
}

signed main() {
    fastIO;
    cin >> n >> m;
    // edgeIO(m);
    fun (i, n) MikuBondage.pb(i);
    fun (i, m) {
        int a, b; cin >> a >> b;
        adj[a].insert(b); adj[b].insert(a);
    }
    sort(all(MikuBondage), check);
    ahegao (j, 1, 6) {
        if (adj[MikuBondage[0]].find(MikuBondage[j]) == adj[MikuBondage[0]].end()) {
            dxd.pb({MikuBondage[0], MikuBondage[j]});
        }
    }
    if (sz(dxd) == 0) {
        cout << "ok";
    } else {
        cout << "mark" << newl << sz(dxd) << newl;
        printVector(dxd);
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3980kb

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
733 310
733 252
733 494
733 139
733 937


input:

1000 3565
626 311
295 222
665 298
534 909
682 582
706 833
155 683
656 841
184 286
392 381
86 259
63 633
37 355
770 790
484 763
209 250
693 401
224 648
974 380
521 380
368 520
676 977
920 112
175 831
715 526
692 125
654 102
70 757
464 840
87 733
956 373
600 137
14 201
368 394
201 178
975 583
557 937
...

output:

ok

result:

ok all right

Test #2:

score: 100
Accepted
time: 1ms
memory: 3820kb

input:

1000 2000
457 335
160 497
464 992
892 255
853 3
308 301
970 363
541 299
89 418
425 128
626 827
603 854
484 874
755 295
607 483
798 552
356 850
320 357
254 940
675 901
168 525
301 636
520 555
773 910
343 701
889 966
218 529
909 950
71 64
682 284
424 138
721 792
670 544
386 72
654 909
725 235
592 437
...

output:

mark
5
747 761
747 727
747 902
747 79
747 151


input:

1000 2005
711 181
320 426
386 503
377 826
97 233
792 231
1 993
440 112
532 381
141 940
505 764
220 6
935 217
728 734
252 673
751 756
178 529
731 827
689 39
764 431
683 752
634 379
727 755
904 500
999 501
70 498
564 74
863 90
543 99
25 858
450 955
411 674
705 758
569 595
414 78
164 502
633 94
50 924
...

output:

ok

result:

ok all right

Test #3:

score: 100
Accepted
time: 2ms
memory: 4132kb

input:

1000 5000
449 632
597 26
701 322
249 190
411 770
666 596
989 995
112 861
445 818
544 659
24 680
739 593
344 439
193 932
600 526
574 869
216 918
716 793
259 686
555 993
255 578
659 271
328 524
729 672
39 771
241 866
27 790
417 109
56 403
338 299
387 232
280 306
589 794
833 419
900 802
54 697
539 807
...

output:

mark
5
869 539
869 566
869 748
869 593
869 202


input:

1000 5005
551 153
467 786
785 219
208 346
802 740
428 127
150 361
435 479
24 121
968 75
699 578
106 119
23 570
128 182
917 352
647 492
128 752
345 228
786 421
13 996
854 465
890 582
471 103
780 461
326 859
516 1
62 839
138 888
321 569
181 533
207 306
5 115
344 252
781 886
629 274
129 462
530 634
843...

output:

ok

result:

ok all right

Test #4:

score: 100
Accepted
time: 0ms
memory: 3968kb

input:

1000 3156
347 398
792 278
754 442
413 757
391 130
636 625
207 437
81 415
47 974
887 779
524 619
379 894
868 594
653 919
29 117
123 867
632 505
648 147
130 420
495 876
637 659
882 348
462 878
282 646
398 525
419 224
926 448
305 934
855 570
396 345
774 918
336 123
502 491
984 783
845 142
790 594
754 4...

output:

mark
4
115 418
115 222
115 422
115 757


input:

1000 3160
540 785
372 439
654 975
845 585
169 154
533 297
215 814
475 825
377 109
439 852
556 16
77 971
843 100
150 509
394 334
611 811
355 876
492 783
180 437
396 138
985 865
20 309
703 203
287 985
253 812
962 456
28 157
766 874
353 918
57 1000
696 310
811 609
1 668
127 255
760 125
702 517
161 741
...

output:

ok

result:

ok all right

Test #5:

score: 100
Accepted
time: 1ms
memory: 4196kb

input:

1000 3433
634 21
789 966
541 959
213 381
366 781
107 649
747 122
336 869
222 648
833 972
929 524
712 524
744 525
568 679
634 163
901 501
56 518
128 587
720 117
208 439
860 85
852 168
934 947
34 858
520 568
408 464
232 432
999 504
71 982
957 372
570 436
281 309
410 405
521 275
554 589
4 707
498 148
5...

output:

mark
4
797 631
797 75
797 432
797 284


input:

1000 3437
976 492
771 824
416 864
904 368
376 943
655 576
49 853
565 396
313 452
899 769
437 114
649 707
593 653
514 637
856 985
685 959
722 527
105 342
513 476
626 331
544 638
776 682
157 7
593 713
474 937
669 188
505 579
565 863
847 969
157 778
671 425
441 167
91 992
767 42
947 455
49 960
97 664
3...

output:

ok

result:

ok all right

Test #6:

score: 100
Accepted
time: 1ms
memory: 3920kb

input:

1000 3057
985 223
432 967
405 822
845 650
893 646
599 718
754 710
333 73
392 355
895 496
200 562
816 36
457 953
9 623
889 662
482 590
249 29
689 694
185 990
285 690
12 323
611 560
903 722
476 86
105 666
441 193
695 640
36 617
840 42
80 527
977 539
606 150
384 585
784 648
919 360
157 532
568 98
995 8...

output:

mark
5
393 134
393 958
393 617
393 919
393 394


input:

1000 3062
308 836
132 203
942 518
49 962
294 184
246 107
638 347
66 316
666 188
733 571
432 540
241 921
990 540
27 44
428 520
22 995
427 446
947 623
964 660
225 40
767 199
330 263
46 503
626 431
706 283
640 971
771 338
215 413
747 356
449 761
454 315
75 314
250 947
624 902
995 567
56 970
191 192
26 ...

output:

ok

result:

ok all right

Test #7:

score: 100
Accepted
time: 1ms
memory: 3944kb

input:

1000 3085
484 405
841 443
661 315
392 941
355 558
523 394
773 929
673 840
5 707
255 610
744 58
301 794
505 33
668 533
787 945
747 810
803 115
340 900
791 909
596 418
129 491
460 698
156 233
664 502
231 465
795 486
829 102
608 212
253 344
419 557
100 421
321 793
207 302
544 479
33 916
736 129
6 156
9...

output:

mark
4
581 807
581 877
581 888
581 305


input:

1000 3089
151 953
628 248
945 220
95 734
105 365
239 616
234 229
241 349
611 937
567 601
160 515
398 570
86 617
572 24
518 662
885 414
728 94
840 929
453 110
194 617
156 600
711 775
508 48
716 321
569 156
452 468
64 517
783 964
277 75
197 710
963 396
877 643
951 787
502 739
157 505
299 371
158 547
6...

output:

ok

result:

ok all right

Test #8:

score: 100
Accepted
time: 2ms
memory: 4076kb

input:

1000 4289
963 66
959 467
930 83
419 699
731 948
702 583
699 245
636 721
859 551
377 251
90 889
286 843
908 47
864 979
223 948
269 684
85 579
162 376
414 255
602 884
65 132
842 907
488 360
553 898
649 249
253 711
675 632
629 446
708 413
819 511
512 113
189 76
242 464
828 261
440 737
643 389
75 907
49...

output:

mark
5
611 622
611 963
611 632
611 783
611 198


input:

1000 4294
771 4
54 929
935 953
570 550
586 368
495 798
933 460
236 163
973 130
610 299
1 338
999 495
636 660
829 18
766 84
445 483
382 832
785 598
74 443
261 847
320 310
668 204
880 425
662 198
752 240
722 628
974 37
444 766
404 955
524 567
67 129
602 33
306 681
781 759
719 642
73 670
538 759
780 98...

output:

ok

result:

ok all right

Test #9:

score: 100
Accepted
time: 2ms
memory: 4320kb

input:

1000 4763
544 167
316 76
78 841
699 1
645 745
827 262
568 545
595 81
924 561
108 253
397 626
142 967
613 397
723 633
711 259
363 249
5 436
165 88
178 463
734 529
195 324
135 41
1000 136
215 967
371 638
588 753
542 909
633 106
537 852
111 232
303 500
892 461
868 300
772 667
40 172
956 575
613 163
933...

output:

mark
4
240 148
240 509
240 425
240 983


input:

1000 4767
450 710
910 74
852 415
624 453
189 429
320 806
262 360
368 338
623 435
701 469
647 910
907 42
40 446
466 428
991 141
500 241
35 644
857 161
426 979
440 717
730 70
202 90
311 604
912 94
526 37
10 429
623 875
968 640
156 592
148 37
432 938
596 843
914 729
13 530
950 907
757 251
455 314
159 9...

output:

ok

result:

ok all right

Test #10:

score: 100
Accepted
time: 2ms
memory: 4280kb

input:

1000 4250
747 446
769 425
773 753
217 298
217 4
514 774
752 3
905 857
532 410
224 250
367 33
29 541
809 996
76 960
25 603
532 600
518 304
546 95
735 413
312 476
83 534
157 62
170 836
668 976
244 557
972 860
828 170
975 468
677 714
800 170
530 191
216 930
242 728
318 505
269 162
579 963
769 822
171 4...

output:

mark
5
384 170
384 747
384 5
384 175
384 951


input:

1000 4255
568 864
703 256
233 301
835 726
658 598
590 999
874 52
868 466
378 512
83 566
128 210
512 152
2 36
736 376
600 242
847 8
345 404
394 524
600 888
953 482
604 348
899 920
19 728
545 697
31 580
45 388
984 718
404 912
377 355
344 270
97 578
848 409
265 174
683 398
349 425
184 94
579 201
240 49...

output:

ok

result:

ok all right

Test #11:

score: 100
Accepted
time: 1ms
memory: 3984kb

input:

1000 3336
161 745
81 702
879 347
452 553
809 32
359 925
984 783
558 366
611 89
948 530
565 496
123 348
534 986
991 511
322 407
6 878
20 897
188 150
527 440
487 333
218 572
597 575
308 684
50 780
900 451
763 785
210 682
964 992
811 537
537 167
320 133
523 899
629 732
435 281
826 405
868 567
201 858
2...

output:

mark
5
299 359
299 947
299 609
299 314
299 565


input:

1000 3341
95 599
885 514
788 334
161 104
297 202
378 338
621 59
164 413
648 432
757 34
909 958
519 348
757 820
58 684
424 105
991 615
576 77
29 119
213 502
503 925
268 989
660 533
153 420
171 997
608 975
762 502
493 289
818 82
370 812
802 918
932 30
236 148
791 72
766 858
465 356
245 984
568 921
332...

output:

ok

result:

ok all right

Test #12:

score: 100
Accepted
time: 2ms
memory: 3940kb

input:

1000 3482
910 881
481 989
349 262
963 679
970 752
651 210
86 339
724 310
765 410
118 619
662 351
568 148
292 61
136 385
997 772
210 735
816 310
698 649
581 313
414 280
92 872
965 925
35 930
813 29
617 210
854 940
486 479
412 644
660 623
126 85
664 327
459 165
266 113
108 206
686 660
918 536
173 366
...

output:

mark
4
213 333
213 963
213 266
213 593


input:

1000 3486
110 216
751 281
537 195
543 565
128 60
866 718
457 367
582 811
87 574
659 616
920 727
493 178
414 169
572 728
338 638
421 211
445 591
455 767
700 651
697 650
845 26
452 346
817 910
478 522
877 240
74 630
797 148
81 271
641 513
402 42
362 36
979 763
847 940
802 766
800 133
882 619
109 298
8...

output:

ok

result:

ok all right

Test #13:

score: 100
Accepted
time: 1ms
memory: 4080kb

input:

1000 2141
358 723
692 581
753 295
864 391
984 462
525 271
508 897
739 537
124 933
577 499
863 37
279 622
361 605
454 951
527 837
1 224
641 404
479 220
931 126
182 719
464 451
805 452
529 800
292 689
17 320
728 790
967 41
412 752
276 535
643 636
611 56
802 414
861 603
857 722
1000 584
435 118
266 392...

output:

mark
5
588 790
588 442
588 478
588 985
588 607


input:

1000 2146
429 482
435 67
324 112
821 542
372 998
408 746
886 426
198 960
211 898
433 165
399 745
986 692
943 831
92 121
562 755
414 271
27 617
355 356
407 480
453 625
796 98
412 425
760 713
923 559
650 792
28 761
315 333
735 379
131 938
110 328
491 753
589 788
597 526
515 710
172 587
338 550
308 447...

output:

ok

result:

ok all right

Test #14:

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

input:

1000 2950
244 361
694 442
547 577
545 866
488 207
888 997
263 45
850 200
30 927
195 510
274 582
467 158
664 667
880 573
522 986
736 375
206 326
999 940
875 609
151 161
602 673
664 200
827 579
12 190
300 249
95 502
951 317
669 243
350 841
692 572
619 302
955 999
480 891
109 779
198 893
105 442
214 14...

output:

mark
4
572 91
572 159
572 54
572 170


input:

1000 2954
141 589
619 109
876 163
983 759
121 799
116 883
191 156
543 832
844 887
356 898
515 408
462 578
437 446
89 995
666 263
526 629
374 882
939 293
15 745
866 649
826 263
624 843
761 247
234 980
864 799
642 464
1000 854
447 249
692 329
978 590
975 887
938 677
131 248
833 279
574 478
317 325
226...

output:

mark
1
189 793


result:

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