Submission #659783

# Submission time Handle Problem Language Result Execution time Memory
659783 2022-11-19T09:23:33 Z PredescuSebastianIon Ronald (COCI17_ronald) C++11
120 / 120
36 ms 3192 KB
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <climits>
#include <iomanip>
#include <cmath>

using namespace std;
constexpr int nmax = 1e3+2;
int n,m,x,y;
bool a[nmax][nmax];
void change(bool a[nmax][nmax],int x)
{
    for(int i=1;i<=n;i++)
    {
        a[i][x] = (a[i][x] == true ? false:true);
        a[x][i] = (a[x][i] == true ? false:true);
    }
    return;
}
bool verificare(bool a[nmax][nmax])
{
    for(int i=1;i<=n;i++)
    {
        if(a[i][1]==false)
        {
            change(a,i);
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(a[i][j]==false)
            {
                return false;
            }
        }
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>x>>y;
        a[x][y]=a[y][x]=true;
    }
    if(verificare(a)==true)
    {
        cout<<"DA"<<'\n';
        return 0;
    }
    cout<<"NE"<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 8 ms 1236 KB Output is correct
3 Correct 3 ms 724 KB Output is correct
4 Correct 3 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 6 ms 1108 KB Output is correct
3 Correct 20 ms 2560 KB Output is correct
4 Correct 36 ms 3192 KB Output is correct