Submission #136162

#TimeUsernameProblemLanguageResultExecution timeMemory
136162cfalasGame (IOI14_game)C++14
0 / 100
2 ms376 KiB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
#define INF 10000

int n;
int con[INF];
int cnt[INF];

void initialize(int x){
	n = x;
}

int hasEdge(int u, int v){
	cnt[u]++;
	cnt[v]++;
	if(cnt[u]==n-1 && cnt[v]<=n-1 && con[u]<=2 || cnt[v]==n-1 && cnt[u]<=n-1 && con[v]<=2){
		con[u]++;
		con[v]++;
		return 1;
	}
	return 0;
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:17:32: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(cnt[u]==n-1 && cnt[v]<=n-1 && con[u]<=2 || cnt[v]==n-1 && cnt[u]<=n-1 && con[v]<=2){
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...