Submission #1159993

#TimeUsernameProblemLanguageResultExecution timeMemory
1159993DangKhoizzzzRonald (COCI17_ronald)C++20
120 / 120
777 ms4388 KiB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pii pair <int , int>
#define arr3 array <int , 3>

/*
+ array limit ???
+ special case ??? n = 1?
+ time limit ???
*/

using namespace std;

const int INF = 1e18 + 7;
const int maxn = 1000 + 7;


int n , m , a[maxn][maxn];

void operate(int x)
{
    for(int i = 1; i <= n; i++)
    {
        a[i][x] = (a[i][x] ^ 1);
    }
    for(int i = 1; i <= n; i++)
    {
        a[x][i] = (a[x][i] ^ 1);
    }
}

void solve()
{
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int u , v; cin >> u >> v;
        a[u][v] = a[v][u] = 1;
    }
    for(int i = 1; i <= n; i++)
    {
        a[i][i] = 1;
    }

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if(a[i][j] == 0)
            {
                operate(j);
            }
        }
    }

    bool check = 1;

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n ;j++)
        {
            if(a[i][j] == 0) check = 0;
        }
    }

    if(check) cout << "DA" << '\n';
    else cout << "NE" << '\n';

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

Compilation message (stderr)

ronald.cpp:16:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   16 | const int INF = 1e18 + 7;
      |                 ~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...