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