# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
550795 | Killer2501 | Zagrade (COI20_zagrade) | C++14 | 889 ms | 15132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pll pair<int, pii>
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
const int N = 2e5+5;
const int M = 350;
const int mod = 1e9+7;
const ll base = 75;
const ll inf = 1e12;
int n, t, tong;
int k, m, a[N], b[N], c[N];
ll ans, dp[N], d[N];
vector<int> adj[N], gr[N];
vector<int> g[N], vi;
void sol()
{
cin >> n >> t;
vi.pb(1);
m = n/2;
for(int i = 2; i <= n; i ++)
{
if(vi.empty())vi.pb(i);
else
{
cout <<"? "<< vi.back() <<" "<<i<<endl;
cin >> k;
if(k)
{
a[vi.back()] = 1;
a[i] = 2;
--m;
vi.pop_back();
}
else vi.pb(i);
}
}
cout << "! ";
for(int i = 1; i <= n; i ++)
{
if(a[i] == 1)cout << '(';
else if(a[i] == 2)cout << ')';
else
{
if(m > 0)
{
cout << ')';
--m;
}
else cout << '(';
}
}
}
int main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
#define task "tests"
if(fopen(task".inp", "r"))
{
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int test = 1;
//cin >> test;
while(test -- > 0)sol();
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... |