Submission #290408

#TimeUsernameProblemLanguageResultExecution timeMemory
290408AaronNaiduGame (IOI14_game)C++14
15 / 100
1 ms640 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, edgeCount; int hasEdge(int u, int v) { if (edgeCount == n-2) { asked[u][v] = true; asked[v][u] = true; return 0; } 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; answer[v][u] = true; edgeCount++; return 1; } if (graph[u].size() >= 2 and graph[v].size() >= 2) { asked[u][v] = true; asked[v][u] = true; return 0; } 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; } }*/ for (auto j : graph[u]) { if (!asked[j][v]) { 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; } }*/ for (auto j : graph[v]) { if (!asked[j][u]) { 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; edgeCount++; return 1; } void initialize(int N) { n = N; edgeCount = 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...