Submission #30432

#TimeUsernameProblemLanguageResultExecution timeMemory
30432kavunGame (IOI14_game)C++14
0 / 100
0 ms26496 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int N, cc[2000], ccsize[2000], asked[2000][2000]; vector <int> ver[2000]; void initialize(int n) { N = n; for(int i = 0; i < n; i++) cc[i] = i, ver[i].push_back(i); } int hasEdge(int u, int v) { if(cc[u] == cc[v]) return 1; if(asked[cc[u]][cc[v]] == ccsize[cc[u]]*ccsize[cc[v]]-1) { ccsize[v] += ccsize[u]; for(int i = 0; i < ver[cc[u]].size(); i++) ver[cc[v]].push_back(ver[cc[u]][i]),cc[ver[cc[u]][i]] = cc[v]; return 1; } else { asked[cc[u]][cc[v]]++; asked[cc[v]][cc[u]]++; return 0; } }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:20:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i = 0; i < ver[cc[u]].size(); i++)
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...