Submission #1139303

#TimeUsernameProblemLanguageResultExecution timeMemory
1139303mychecksedadGame (IOI14_game)C++17
0 / 100
1 ms328 KiB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
const int N = 1000+100, M = 1e5+10, K = 52, MX = 30;

vector<int> c;
bitset<N> b[N];
int x = 0, nn = 0;
void initialize(int n) {
    c.resize(n, n-1);
    x = 0;
    nn =n;
    for(int j = 0 ;j < n; ++j) b[j][j] = 1;
}
map<pii, bool> co;
int hasEdge(int u, int v) {
    if(!co[{u, v}]){
        --c[u], --c[v];
        b[u][v] = 1;
        b[v][u] = 1;
    }
    // cout << c[u] << ' ' << c[v] << ' ';
    if(c[u] <= 1){
        for(int j = 0; j < nn; ++j) if(b[u][j] == 0){
            co[{u, j}] = 1;
            co[{j, u}] = 1;
            --c[j];
            b[u][j] = 1;
            b[j][u] = 1;
        }
    }
    if(c[v] <= 1){
        for(int j = 0; j < nn; ++j) if(b[v][j] == 0){
            co[{v, j}] = 1;
            co[{j, v}] = 1;
            --c[j];
            b[j][v] = b[v][j] = 1;
        }
    }
    // for(int j = 0; j < nn; ++j) cout << c[j] << ' ';


    if(co[{u, v}]) return 1;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...