QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322060#4829. Mark on a Graphalexz12050 3ms4516kbC++141.6kb2024-02-06 08:49:432024-02-06 08:49:44

Judging History

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

  • [2024-02-06 08:49:44]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:4516kb
  • [2024-02-06 08:49:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define nums1 adj[x]
#define nums2 pos.back()

// mark graph in O(n^2+mn)

// check graph
    // dfs

const int N = 1000;

vector<set<int>> pos; 
set<int> adj[N];

bool dfs(int x, int d = 1){
    if (d == 5){
        return 1;
    }
    // set<int>* nums = &adj[i];
    set<int> next;
    auto i = nums1.begin();
    auto j = nums2.begin();
    while (i != nums1.end() && j != nums2.end()){
        if (*i == *j){
            next.insert(next.end(), *i);
        }else if (*i > *j){
            j ++;
        }else {
            i ++;
        }
    }
    pos.push_back(next);
    for (int v: next){
        if (dfs(v, d+1)) return 1;
    }
    return 0;
}

pair<int, int> edgeCheck[5] = {
{235, 156}, 
{166, 91}, 
{538, 650}, 
{987, 679}, 
{373, 792}};

set<pair<int, int>> edges;

int main(){
    int n, m;
    cin >> n >> m;
    for (int x = 0; x < m; x ++){
        int a, b;
        cin >> a >> b;
        a --, b --;
        adj[a].insert(b);
        adj[b].insert(a);
        edges.insert({a, b});
        edges.insert({b, a});
    }
    vector<pair<int, int>> change;
    for (int x = 0; x < 5; x ++){
        if (edges.find(edgeCheck[x]) == edges.end()){
            change.push_back(edgeCheck[x]);
        }
    }
    if (change.empty()){
        cout << "ok" << endl;
    }else {
        cout << "mark" << endl;
        cout << change.size() << endl;
        for (pair<int, int> x: change){
            cout << x.first+1 << " " << x.second+1 << endl;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 4516kb

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
236 157
167 92
539 651
988 680
374 793

input:

1000 3565
626 311
882 830
665 298
534 977
682 582
107 833
155 683
290 639
184 217
392 381
676 187
937 771
397 161
379 167
655 180
484 763
342 897
224 648
974 380
521 228
368 663
794 364
113 49
639 831
715 526
457 125
567 806
70 757
955 736
11 507
355 335
232 412
14 201
368 394
201 178
617 583
65 485...

output:

mark
5
236 157
167 92
539 651
988 680
374 793

result:

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