Submission #284947

#TimeUsernameProblemLanguageResultExecution timeMemory
284947triplem5dsGame (IOI14_game)C++14
42 / 100
1090 ms728 KiB
#include "game.h"
#include "bits/stdc++.h"
using namespace std;
bitset<1505> cnc[1505];
int N;
void initialize(int n) {
  N = n;
  for(int i = 0; i < n; i++)
    for(int j = i + 1; j < n; j++)
      cnc[i][j] = cnc[j][i] = 1;
}
bitset<1505> cur;
int dfs(int node){
  int ans = 1;
  cur[node] = 0;
  bitset<1505> to = cur & cnc[node];
  cur &= ~to;
  for(auto x = to._Find_first(); x < N; x = to._Find_next(x)){
    ans += dfs(x);
  }

  return ans;
}
int hasEdge(int u, int v) {

  cnc[u][v] = cnc[v][u] = 0;
  for(int i = 0; i < N; i++)cur.set(i);
  if(dfs(0) != N){
    cnc[u][v] = cnc[v][u] = 1;
    return 1;
  }

  return 0;
}

Compilation message (stderr)

game.cpp: In function 'int dfs(int)':
game.cpp:18:36: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'int' [-Wsign-compare]
   18 |   for(auto x = to._Find_first(); x < N; x = to._Find_next(x)){
      |                                  ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...