# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
73510 | yusufake | parentrises (BOI18_parentrises) | C++98 | 29 ms | 11120 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define _ int v, int tl, int tr, int l, int r
#define tm (tl+tr >> 1)
#define sol v+v,tl,tm,l,r
#define sag v+v+1,tm+1,tr,l,r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pp pair<int,int>
const int N = 1e6 + 6;
int V[N],v,zz,ww,n,i,p,ok;
char s[N],ans[N];
int main(){
scanf("%d%d",&zz,&ww);
if(zz == 2) return 0;
for(;ww--;){
scanf(" %s",s+1);
n = strlen(s+1);
p = v = 0;
ok = 1;
for(i=1;i<=n;i++) ans[i] = 'G';
ans[n+1] = 0;
for(i=1;i<=n;i++){
p += s[i] == ')' ? 1 : -1;
if(s[i] == ')') V[++v] = i;
if(p > 0){
ans[ V[v--] ] = 'B';
ans[ V[v--] ] = 'R';
p = 0;
if(v == -1) { ok=0; break; }
}
}
p = v = 0;
for(i=n; i ;i--){
p += s[i] == '(' ? 1 : -1;
if(s[i] == '(') V[++v] = i;
if(p > 0){
ans[ V[v--] ] = 'B';
ans[ V[v--] ] = 'R';
p = 0;
if(v == -1) { ok=0; break; }
}
}
puts(ok ? ans+1 : "impossible");
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |