Submission #290396

#TimeUsernameProblemLanguageResultExecution timeMemory
290396AaronNaiduGame (IOI14_game)C++14
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; vector<int> graph[2000]; bool asked[2000][2000]; bool answer[2000][2000]; int n; int hasEdge(int u, int v) { if (graph[u].size() == 0 and graph[v].size() == 0) { graph[u].push_back(v); graph[v].push_back(u); asked[u][v] = true; asked[v][u] = true; answer[u][v] = true; return 1; } if (graph[u].size() >= 1) { for (int i = 0; i < n; i++) { if (i != v and i != u and !asked[i][u]) { asked[u][v] = true; asked[v][u] = true; return 0; } } } if (graph[v].size() >= 1) { for (int i = 0; i < n; i++) { if (i != u and i != v and !asked[i][v]) { asked[u][v] = true; asked[v][u] = true; return 0; } } } graph[v].push_back(u); graph[u].push_back(v); asked[u][v] = true; answer[u][v] = true; asked[v][u] = true; answer[v][u] = true; return 1; } void initialize(int N) { n = N; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...