Submission #47610

# Submission time Handle Problem Language Result Execution time Memory
47610 2018-05-05T15:34:32 Z Vasiljko Ronald (COCI17_ronald) C++14
120 / 120
59 ms 13220 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD = 1e9+7;
const int N = 1e3+5;
int n,m,mat[N][N],a[N][N];
vector<int>v[N],r[N];

void change(){
    for(int i=2;i<=n;i++){
        if(!mat[1][i]){
            for(int j=1;j<=n;j++){
                if(j==i)continue;
                mat[i][j]^=1;
                mat[j][i]^=1;
            }
        }
    }
}

void check(){
    bool ok=true;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(!mat[i][j]&&i!=j)ok=false;
    if(ok){
        cout<<"DA";
        exit(0);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    int x,y;
    while(m--){
        cin>>x>>y;
        mat[x][y]=1;
        mat[y][x]=1;
        a[x][y]=1;
        a[y][x]=1;
    }
    change();
    check();
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)mat[i][j]=a[i][j];
    for(int i=2;i<=n;i++){
        mat[1][i]^=1;
        mat[i][1]^=1;
    }
    change();
    check();
    cout<<"NE";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 652 KB Output is correct
4 Correct 2 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 676 KB Output is correct
2 Correct 2 ms 836 KB Output is correct
3 Correct 2 ms 836 KB Output is correct
4 Correct 2 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 924 KB Output is correct
2 Correct 2 ms 988 KB Output is correct
3 Correct 2 ms 992 KB Output is correct
4 Correct 2 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1040 KB Output is correct
2 Correct 2 ms 1040 KB Output is correct
3 Correct 2 ms 1192 KB Output is correct
4 Correct 2 ms 1196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1456 KB Output is correct
2 Correct 2 ms 1464 KB Output is correct
3 Correct 3 ms 1616 KB Output is correct
4 Correct 3 ms 1648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2572 KB Output is correct
2 Correct 16 ms 5460 KB Output is correct
3 Correct 7 ms 5460 KB Output is correct
4 Correct 7 ms 5460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5460 KB Output is correct
2 Correct 16 ms 6012 KB Output is correct
3 Correct 58 ms 11348 KB Output is correct
4 Correct 59 ms 13220 KB Output is correct