Submission #525670

#TimeUsernameProblemLanguageResultExecution timeMemory
525670tatyamHandcrafted Gift (IOI20_gift)C++17
100 / 100
143 ms22672 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]; imos.pop_back(); for(int& x : imos) x = !x; string s(n, 'R'); for(int i = 0; i < n - 1; i++){ if(imos[i]) s[i + 1] = s[i] ^ 'R' ^ 'B'; else s[i + 1] = s[i]; } imos.insert(imos.begin(), 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...