This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |