Submission #2861493


Source Code Expand

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair



bool solve(int N, int M, vi& a, vi& b){
    vvi nxt(N);
    rep(i,M){
        nxt[a[i]].pb(b[i]);
        nxt[b[i]].pb(a[i]);
    }
    rep(i,N){
        if (nxt[i].size() % 2 != 0) return false;
    }
    return true;
}

int main() {
    int N, M; cin >> N >> M;
    vi a(M), b(M);
    rep(i,M) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
    }
    cout << (solve(N,M,a,b) ? "YES":"NO") << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Unplanned Queries
User naoya_t
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1667 Byte
Status AC
Exec Time 72 ms
Memory 6144 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 20
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 72 ms 6144 KB
in10.txt AC 68 ms 5504 KB
in11.txt AC 54 ms 2688 KB
in12.txt AC 68 ms 5504 KB
in13.txt AC 67 ms 5504 KB
in14.txt AC 72 ms 6144 KB
in15.txt AC 1 ms 256 KB
in16.txt AC 1 ms 256 KB
in2.txt AC 70 ms 6144 KB
in3.txt AC 72 ms 6144 KB
in4.txt AC 72 ms 6144 KB
in5.txt AC 72 ms 6144 KB
in6.txt AC 68 ms 5504 KB
in7.txt AC 68 ms 5504 KB
in8.txt AC 69 ms 5504 KB
in9.txt AC 69 ms 5504 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB