Submission #301583

#TimeUsernameProblemLanguageResultExecution timeMemory
301583kevinsogoHandcrafted Gift (IOI20_gift)C++17
0 / 100
4 ms640 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) { vector<int> same(n); for (int i = 0; i < r; i++) { if (x[i] == 1) { same[a[i]]++; same[b[i]]--; } } for (int i = 0; i < n - 1; i++) same[i + 1] += same[i]; assert(same.back() == 0); vector<int> diff(n); for (int i = 0; i < n; i++) diff[i + 1] = diff[i] + !same[i]; for (int i = 0; i < r; i++) { if (x[i] == 1) assert(diff[a[i]] == diff[b[i]]); if (x[i] == 2 && diff[a[i]] == diff[b[i]]) return 0; } string s(n, 'R'); for (int i = 0; i < n - 1; i++) { if (!same[i]) s[i + 1] = s[i] ^ 'R' ^ 'B'; } craft(s); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...