Submission #48325

#TimeUsernameProblemLanguageResultExecution timeMemory
48325jwvg0425Game (IOI14_game)C++17
15 / 100
2 ms648 KiB
#include <stdio.h> #include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <bitset> #include <map> #include <set> #include <tuple> #include <string.h> #include <math.h> #include <random> #include <functional> #include <assert.h> #include <math.h> using namespace std; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; vector<int> counts; vector<int> has; int total; int remain; int need; void initialize(int n) { total = n - 1; remain = n * (n - 1) / 2; need = n - 1; counts.resize(n); has.resize(n); } //n-1개의 엣지를 만든다 //모든 정점에 대해 degree를 1 이상으로 만든다 int hasEdge(int u, int v) { int res = 0; if ((counts[u] == total - 1 && has[u] == 0) || (counts[v] == total - 1 && has[v] == 0) || remain == need) { res = 1; has[u]++; has[v]++; need--; } counts[u]++; counts[v]++; remain--; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...