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 "gift.h"
#include<bits/stdc++.h>
#include<string>
using namespace std;
int cnt[500005];
int red[500005];
int su[500005];
int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) {
for(int i=0;i<r;i++)
{
if(x[i] == 2)continue;
cnt[a[i]]+=1;
cnt[b[i]+1] += -1;
}
int les = 0;
for(int i=0;i<n;i++)
{
les += cnt[i];
if(les >= 1)red[i] = 1;
}
su[0] = red[0];
for(int i=1;i<n;i++)su[i] = su[i-1] + red[i];
for(int i=0;i<r;i++)
{
if(x[i] == 1)continue;
int xx = su[b[i]] - su[max(a[i]-1,0)];
if(xx == b[i]-a[i]+1)return 0;
}
string s;
for(int i=0;i<n;i++)
{
if(red[i] == 1)s += "R";
else s += "B";
}
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... |