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>
#include "gift.h"
using namespace std;
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstdio>
#include <string>
vector<int>parent;
int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) {
parent.resize(n);
for(int l=0;l<n;l++)
parent[l]=l;
for(int i = 0; i < r; i++){
if(x[i] == 2) continue;
for (int e = a[i] + 1; e < b[i] + 1; e++)
parent[e] = parent[b[i]];
}
for(int i=0; i < r; i++) {
if(x[i] == 1) continue;
if(a[i] == b[i]) return 0;
if (parent[b[i]] - parent[a[i]] < 1)
return 0;
}
string s ="R";
for(int i=1;i<n;i++)
{
if(parent[i] != parent[i-1])
if(s.back() == 'R')s += "B";
else s+= "R";
else s+= s.back();
}
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... |