| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1349799 | phamngocphuc2008 | Dark Ride (EGOI25_darkride) | C++20 | 1 ms | 480 KiB |
#include <bits/stdc++.h>
using namespace std;
int query(string ask)
{
cout << "? " << ask << endl;
int ans;
cin >> ans;
return ans;
}
void answer(int pos1, int pos2)
{
cout << "! " << pos1 << ' ' << pos2 << endl;
return;
}
bool is_set(int i, int j)
{
return (i >> j) & 1;
}
int main()
{
int n;
cin >> n;
int x = 0;
int d = 0;
for(int i = 0; (1 << i) < n; ++i)
{
int k = (1 << i);
string ask(n, '0');
for(int j = 0; j < n; ++j) if(is_set(j, i)) ask[j] = '1';
int res = query(ask);
if(res % 2 == 1)
{
x |= k;
d = i;
}
}
int a = 0;
for(int i = 0; (1 << i) < n; ++i)
{
int k = (1 << i);
string ask(n, '0');
for(int j = 0; j < n; ++j) if(is_set(j, i) && is_set(j, d)) ask[j] = '1';
int res = query(ask);
if(res % 2 == 1) a |= k;
}
answer(a, a^x);
}
| # | 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... | ||||
