답안 #659783

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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