Submission #6374179


Source Code Expand

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

int main()
{
    int n,m;
    cin>>n>>m;
    int i,j,k=0;
    int deg[200005]={0};
    vector<int> a[n+5];
    for(i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        a[x].push_back(y);
        a[y].push_back(x);
        deg[x]++;
        deg[y]++;
    }
    
    vector<pair<int,int>> v;
    for(i=1;i<=n;i++){
        if(deg[i]%2==0 && deg[i]>0){
            for(j=0;j<a[i].size();j++){
                v.push_back({i,a[i][j]});
                deg[i]--;
                deg[a[i][j]]--;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(deg[i]>0){
            
            cout<<"-1";
            return 0;
        }
    }
    for(auto tt:v){
        cout<<tt.first<<' '<<tt.second<<"\n";
    }

    
    
}

Submission Info

Submission Time
Task B - Even Degrees
User priyam2k
Language C++14 (GCC 5.4.1)
Score 0
Code Size 820 Byte
Status WA
Exec Time 76 ms
Memory 7676 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 2
AC × 12
WA × 24
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt WA 75 ms 7676 KB
02.txt WA 76 ms 7676 KB
03.txt WA 73 ms 7676 KB
04.txt WA 75 ms 7676 KB
05.txt AC 74 ms 7676 KB
06.txt WA 71 ms 5496 KB
07.txt WA 71 ms 5496 KB
08.txt WA 71 ms 5496 KB
09.txt WA 72 ms 5496 KB
10.txt AC 71 ms 5496 KB
11.txt WA 58 ms 3836 KB
12.txt WA 58 ms 3836 KB
13.txt WA 58 ms 3836 KB
14.txt WA 58 ms 3836 KB
15.txt AC 58 ms 3836 KB
16.txt WA 51 ms 3320 KB
17.txt WA 51 ms 3320 KB
18.txt WA 51 ms 3320 KB
19.txt WA 51 ms 3320 KB
20.txt AC 51 ms 3320 KB
21.txt WA 46 ms 3328 KB
22.txt WA 45 ms 3328 KB
23.txt WA 45 ms 3328 KB
24.txt WA 45 ms 3328 KB
25.txt AC 48 ms 3328 KB
26.txt AC 73 ms 7672 KB
27.txt AC 73 ms 7672 KB
28.txt WA 73 ms 7672 KB
29.txt WA 72 ms 7672 KB
30.txt WA 1 ms 1024 KB
31.txt AC 1 ms 1024 KB
32.txt AC 1 ms 1024 KB
33.txt AC 1 ms 1024 KB
34.txt WA 1 ms 1024 KB
s1.txt AC 1 ms 1024 KB
s2.txt AC 1 ms 1024 KB