# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960415 | IUA_Hasin | Game (IOI14_game) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define endl "\n"
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define ll long long
using namespace std;
#include "game.h"
const ll N = 1500;
ll query[N], deg[N], vis[N];
ll cnt, a;
void initialize(int n) {
cnt = 0;
a = n;
for(int i=0; i<N; i++){
query[i]=0;
deg[i] = 0;
vis[i] = 0;
}
}
int hasEdge(int u, int v) {
if(vis[u]==0 && vis[v]==0){
query[u]++;
query[v]++;
deg[u]++;
deg[v]++;
vis[u]++;
vis[v]++;
return 1;
} else {
if(vis[u]>0 && vis[v]>0){
query[u]++;
query[v]++;
return 0;
} else {
if(vis[u]==0){
if(query[u]==a-2){
query[u]++;
query[v]++;
deg[u]++;
deg[v]++;
vis[u]++;
vis[v]++;
return 1;
} else {
query[u]++;
query[v]++;
return 0;
}
} else if(vis[v]==0){
if(query[v]==a-1){
query[u]++;
query[v]++;
deg[u]++;
deg[v]++;
vis[u]++;
vis[v]++;
return 1;
} else {
query[u]++;
query[v]++;
return 0;
}
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |