Submission #120792

#TimeUsernameProblemLanguageResultExecution timeMemory
120792win11905Game (IOI14_game)C++11
15 / 100
4 ms512 KiB
#include "game.h"
#include <set>
using namespace std;

set<int> S[1505];
bool nott[1505];

void initialize(int n) {
    for(int i = 0; i < n; ++i) for(int j = 0; j < n; ++j) if(i != j) {
        S[i].emplace(j);
    }
}

int hasEdge(int u, int v) {
    bool st = S[u].size() <= 1 || S[v].size() <= 1;
    if(S[u].count(v)) S[u].erase(v);
    else st = true;
    if(S[v].count(u)) S[v].erase(u);
    else st = true;
    if(st) nott[u] = nott[v] = true;
    if(S[u].size() == 1 && nott[u] == false) {
        int a = *S[u].begin();
        if(S[a].count(u)) S[a].erase(u);
    } 
    if(S[v].size() == 1 && nott[v] == false) {
        int a = *S[v].begin();
        if(S[a].count(v)) S[a].erase(v);
    }
    return st;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...