이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i,l,r) for(int i=(l); i<=(r); ++i)
#define REP(i,l,r) for(int i=(l); i<(r); ++i)
#define FORD(i,r,l) for(int i=(r); i>=(l); --i)
#define REPD(i,r,l) for(int i=(r)-1; i>=(l); --i)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<class key, class value = null_type, class cmp = std::less<key>>
using ordered_set = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
void craft(std::string &s);
int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) {
    ordered_set<int> ST;
    FOR(i, 0, n) ST.insert(i);
    REP(i, 0, r) if (x[i] == 1) {
        while (true) {
            auto pos = ST.upper_bound(a[i]);
            if (*pos <= b[i]) ST.erase(pos);
            else break;
        }
    }
    REP(i, 0, r) if (x[i] == 2) {
        if (ST.upper_bound(a[i]) == ST.upper_bound(b[i]))
            return 0;
    }
    string s;
    int tmp = 0;
    for(auto i2 = ST.begin(), i = i2++; i2 != ST.end(); i = i2++) {
        tmp ^= 1;
        char c = tmp ? 'R' : 'B';
        REP(j, *i, *i2) s += c;
    }
    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... |