Submission #525665

#TimeUsernameProblemLanguageResultExecution timeMemory
525665tatyamHandcrafted Gift (IOI20_gift)C++17
50 / 100
139 ms22916 KiB
#include <bits/stdc++.h> using namespace std; void craft(string &s); int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x){ vector<int> imos(n); for(int i = 0; i < r; i++) if(x[i] == 1){ imos[a[i]]++; imos[b[i]]--; } for(int i = 0; i < n - 1; i++) imos[i + 1] += imos[i]; string s(n, 'R'); for(int i = 0; i < n - 1; i++){ if(imos[i]) s[i + 1] = s[i]; else s[i + 1] = s[i] ^ 'R' ^ 'B'; } for(int& x : imos) x = !x; imos.back() = 0; for(int i = 0; i < n - 1; i++) imos[i + 1] += imos[i]; for(int i = 0; i < r; i++) if(x[i] == 2){ if(imos[a[i]] == imos[b[i]]) return 0; } 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...