| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 390839 | A_D | Zagrade (COI20_zagrade) | C++14 | 812 ms | 328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
void ask(int a,int b)
{
cout<<"? "<<a<<" "<<b<<endl;
}
void solve()
{
int n,q,x;
cin>>n>>q;
string s(n+1,'0');
s[1]='(';
s[n]=')';
int l=2,r=n-1;
while(l<=r){
ask(l,r);
cin>>x;
if(x==1){
s[l]='(';
s[r]=')';
l++;
r--;
}
else{
if(l+1==r){
s[l]=')';
s[r]='(';
l++;
r--;
}
else{
ask(l-1,l);
cin>>x;
if(x==1){
s[l]=')';
l++;
}
else{
s[r]=')';
r--;
}
}
}
}
string ans;
for(int i=1;i<=n;i++){
ans+=s[i];
}
cout<<"! "<<ans<<endl;
}
main()
{
int t=1;
// cin>>t;
while(t--)solve();
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
