QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#801535 | #9783. Duloc Network | MrPavlito | WA | 1ms | 3580kb | C++17 | 2.0kb | 2024-12-07 01:15:23 | 2024-12-07 01:15:23 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
//#define endl "\n"
#define pii pair<int,int>
using namespace std;
const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;
int n;
int query(string s)
{
cout << "? " << s << endl;
cout.flush();
int x;
cin >> x;
return x;
}
string craft(set<int>& niz)
{
string s;
for(int i=0; i<n; i++)s+='0';
for(auto x: niz)s[x] = '1';
return s;
}
void guess(bool t)
{
if(t)cout << "! 1" << endl;
else cout << "! 0" << endl;
}
map<string,int> mapa;
signed main()
{
ios_base::sync_with_stdio(false),cin.tie(0), cout.tie(0);
int tt=1;
//cin >> tt;
while(tt--)
{
cin >> n;
vector<int> cnt(n+1);
string s;
for(int i=0; i<n; i++)s+='0';
set<int> org;
org.insert(0);
bool resenje = 1;
for(int i = 0; i<n; i++)
{
int trenutno = query(craft(org));
int l = 0;
int r = n-1;
int rez = n;
while(l<=r)
{
int mid = l+r >> 1;
set<int> niz = org;
for(int j= i; j<=mid; j++)niz.insert(j);
set<int> setic;
for(auto x:niz)if(!org.count(x))setic.insert(x);
int trcnt = 0;
int tre1 = query(craft(niz));
int tre2 = query(craft(setic));
if(trenutno + tre2 == tre1)l = mid+1;
else
{
r = mid-1;
rez = mid;
}
}
if(rez == n)
{
resenje = false;
break;
}
org.insert(rez);
//for(auto x: org)cout << x << " ";cout << endl;
}
guess(resenje);
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
4 1 2 3 1 0 2 2 0 1 2 1 1 0 1 0 0 2 0 0 0 0 0 0 0
output:
? 1000 ? 1100 ? 0100 ? 1000 ? 0000 ? 1100 ? 1100 ? 0000 ? 1110 ? 0010 ? 1110 ? 1110 ? 0000 ? 1110 ? 0000 ? 1111 ? 0001 ? 1111 ? 1111 ? 0000 ? 1111 ? 0000 ? 1111 ? 0000 ! 0
result:
wrong answer Wrong answer.