QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261102 | #7804. Intersegment Activation | Geospiza# | WA | 1ms | 3416kb | C++20 | 1.7kb | 2023-11-22 17:58:10 | 2023-11-22 17:58:11 |
Judging History
answer
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define Ma 1000005
#define G 3
#define N 11
#define pb push_back
#define L (1<<21)
#define PLL pair<ll,ll>
#define fi first
#define se second
#define all(x) x.begin(),x.end()
using namespace std;
ll n;
vector <ll> dfs(ll cnt,vector <ll> v)
{
if (cnt==0)
return v;
ll lim=v.size();
ll be=v.back();
vector <ll> ans=v;
for (auto z:v)
ans.pb(z^lim^be);
return dfs(cnt-1,ans);
}
ll flag=0;
ll rd(ll l,ll r)
{
if (flag)
return n;
cout<<l<<" "<<r<<endl;
ll ans;
cin>>ans;
if (ans==n)
flag=1;
return ans;
}
ll all=0;
ll sum(ll x)
{
ll ans=0;
while (x!=1)
x>>=1,ans++;
return ans;
}
void go(ll l,ll r)
{
if (l>r||flag)
return ;
rd(l,l);
ll p=rd(l,l);
if (p!=all)
{
vector <ll> g;
g.pb(l-1);
for (ll i=l;i<=r;i++)
{
ll ne=rd(i,i);
rd(i,i);
if (ne==p-1)
all++,g.pb(i);
}
g.pb(r+1);
for (ll i=1;i<g.size();i++)
go(g[i-1]+1,g[i]-1);
return;
}
vector <ll> v;
v.pb(0);
v=dfs(r-l+1,v);
for (ll i=1;i<v.size();i++)
{
ll pw=sum(v[i]^v[i-1]);
p=rd(l,l+pw);
if (p!=all)
return go(l,r);
}
}
void sol()
{
cin>>n;
all=0;
go(1,n);
}
int main(){
//ios::sync_with_stdio(0); cin.tie(0);
int tt=1;
//cin>>tt;
while (tt--)
sol();
return 0;
}
/*
3
2
1 1
2 2
4
0 1
1 0
3 1
4 0
5
0 1
1 0
1 2
2 2
4 2
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3416kb
input:
3 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
output:
1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 2 1 1
result:
wrong answer format Unexpected end of file - int32 expected