Submission #933315

#TimeUsernameProblemLanguageResultExecution timeMemory
933315SmuggingSpunGame (IOI14_game)C++14
15 / 100
3 ms11096 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; const int lim = 1505; int p[lim], sz[lim], cnt[lim][lim]; int find_set(int n){ return n == p[n] ? n : p[n] = find_set(p[n]); } void merge(int a, int b){ if((a = find_set(a)) != (b = find_set(b))){ if(sz[a] < sz[b]){ swap(a, b); } sz[p[b] = a] += sz[b]; } } void initialize(int n){ iota(p, p + n, 0); fill(sz, sz + n, 1); memset(cnt, 0, sizeof(cnt)); } int hasEdge(int u, int v){ if(sz[u = find_set(u)] * sz[v = find_set(v)] - 1 == cnt[u][v] || u == v){ merge(u, v); return 1; } cnt[u][v]++; cnt[v][u]++; return 0; }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:23:32: warning: operation on 'v' may be undefined [-Wsequence-point]
   23 |  if(sz[u = find_set(u)] * sz[v = find_set(v)] - 1 == cnt[u][v] || u == v){
      |                              ~~^~~~~~~~~~~~~
game.cpp:23:32: warning: operation on 'v' may be undefined [-Wsequence-point]
game.cpp:23:10: warning: operation on 'u' may be undefined [-Wsequence-point]
   23 |  if(sz[u = find_set(u)] * sz[v = find_set(v)] - 1 == cnt[u][v] || u == v){
      |        ~~^~~~~~~~~~~~~
game.cpp:23:10: warning: operation on 'u' may be undefined [-Wsequence-point]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...