Submission #428435

#TimeUsernameProblemLanguageResultExecution timeMemory
428435Rouge_HugoGame (IOI14_game)C++14
42 / 100
112 ms1064 KiB
#include<bits/stdc++.h>
#include "game.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
int n;
const int N=100;
int vis[N],yes[N][N];
void dfs(int x)
{
    if(vis[x])return;
    vis[x]=1;
    for(int it=0;it<n;it++)
    {
        int z=it,zz=x;
        if(z>zz)swap(z,zz);
        if(yes[z][zz]!=-1)continue;
        if(vis[it])continue;
        dfs(it);
    }
}
void initialize(int N) {
    n=N;
    memset(yes,-1,sizeof yes);

}

int hasEdge(int x, int y) {
   if(x>y)swap(x,y);memset(vis,0,sizeof vis);
   yes[x][y]=0;
   dfs(x);
   if(vis[y]){
    yes[x][y]=0;
    yes[y][x]=0;
    return 0;
   }
   yes[x][y]=1;
   yes[y][x]=1;
   return 1;
}
/*
4
0 1
0 2
0 3
3 1
1 2
3 2
*/

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:31:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   31 |    if(x>y)swap(x,y);memset(vis,0,sizeof vis);
      |    ^~
game.cpp:31:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   31 |    if(x>y)swap(x,y);memset(vis,0,sizeof vis);
      |                     ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...