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 <cstring>
#include <string>
#include <vector>
using namespace std;
const int N = 500000;
typedef vector<int> vi;
int construct(int n, int m, vi ll, vi rr, vi kk) {
static int dd[N];
memset(dd, 0, n * sizeof *dd);
for (int h = 0; h < m; h++)
if (kk[h] == 1)
dd[ll[h]]++, dd[rr[h]]--;
for (int i = 1; i < n; i++)
dd[i] += dd[i - 1];
for (int i = n - 1; i > 0; i--)
dd[i] = dd[i - 1] == 0 ? 1 : 0;
dd[0] = 0;
for (int i = 1; i < n; i++)
dd[i] += dd[i - 1];
for (int h = 0; h < m; h++)
if (kk[h] == 2 && dd[rr[h]] - dd[ll[h]] == 0)
return 0;
string cc(n, 0);
for (int i = 0; i < n; i++)
cc[i] = dd[i] % 2 == 0 ? 'R' : 'B';
craft(cc);
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... |