Submission #30440

#TimeUsernameProblemLanguageResultExecution timeMemory
30440kavunGame (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), ccsize[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]; int othercc = cc[u]; for(int i = 0; i < ver[othercc].size(); i++) ver[cc[v]].push_back(ver[othercc][i]),cc[ver[othercc][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:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i = 0; i < ver[othercc].size(); i++)
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...