이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gift.h"
#include <bits/stdc++.h>
using namespace std;
int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) {
    int painting[n + 1] = {0};
    for (int i = 0; i < r; i ++) {
      if (x[i] == 1) {
        painting[b[i] + 1] --;
        painting[a[i]] ++;
      }
    }
    for (int i = 1; i < n; i ++) {
      painting[i] += painting[i - 1];
    }
    int encrypt[n + 1] = {0};
    int ind = 0, color = 0;
    string s(n, 'R');
    while (ind < n) {
      if (painting[ind] == 0) {
        encrypt[ind] = color;
        ind ++;
      }
      else {
        while ((ind < n) and (painting[ind] >= 1)) {
          encrypt[ind] = color;
          ind ++;
        }
      }
      color = (color + 1) % 2;
    }
    for (int i = 0; i < n; i ++) {
      if (encrypt[i] == 0) s[i] = 'R';
      else s[i] = 'B';
    }
    int pref[n + 1] = {0};
    for (int i = 1; i <= n; i ++) {
      pref[i] = encrypt[i] + pref[i - 1];
    }
    for (int i = 0; i < r; i ++) {
      int cible = pref[b[i]] - pref[a[i] - 1];
      int longueur = b[i] - a[i] + 1;
      if (x[i] == 2) {
        if ((0 < cible) and (cible < longueur)) ;
        else {
          return 0;
        }
      }
      else {
        if ((0 < cible) and (cible < longueur)) return 0;
        else ;
      }
    }
    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... |