QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#261137#7804. Intersegment ActivationGeospizaWA 1ms3364kbC++201.7kb2023-11-22 18:13:252023-11-22 18:13:25

Judging History

你现在查看的是最新测评结果

  • [2023-11-22 18:13:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3364kb
  • [2023-11-22 18:13:25]
  • 提交

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
*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3364kb

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