# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
774202 | 2023-07-05T12:55:47 Z | vjudge1 | Zagrade (COI20_zagrade) | C++17 | 846 ms | 600 KB |
#include<bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); //#define endl "\n" #define ll long long #define N 200005 #define pb push_back int main(){ lalala; int n,q;cin>>n>>q; stack<int> s; char str[n+1]; s.push(1); str[1]='('; for(int i=2;i<=n;i++){ if(s.size()){ int a=s.top(); cout<<"? "<<a<<" "<<i<<endl; int x;cin>>x; if(x==1){ str[i]=')'; s.pop(); } else{ str[i]='('; s.push(i); } } else{ s.push(i); str[i]='('; continue; } } int i=1; while(s.size()){ char a='('; if(i>s.size()/2)a=')'; str[s.top()]=a; s.pop(); i++; } cout<<"! "; for(i=1;i<=n;i++)cout<<str[i]; cout<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 2 ms | 208 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 9 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
8 | Correct | 7 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Incorrect | 8 ms | 312 KB | Mismatch at position 501. Expected (, found ) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 197 ms | 400 KB | Output is correct |
3 | Correct | 795 ms | 388 KB | Output is correct |
4 | Correct | 846 ms | 392 KB | Output is correct |
5 | Correct | 643 ms | 392 KB | Output is correct |
6 | Correct | 582 ms | 384 KB | Output is correct |
7 | Correct | 562 ms | 600 KB | Output is correct |
8 | Correct | 619 ms | 396 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Mismatch at position 3. Expected (, found ) |
2 | Halted | 0 ms | 0 KB | - |