QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261060#7804. Intersegment ActivationGeospiza#WA 0ms3388kbC++202.0kb2023-11-22 17:42:152023-11-22 17:42:15

Judging History

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

  • [2023-11-22 17:42:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3388kb
  • [2023-11-22 17:42:15]
  • 提交

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)
        return ;
    vector <ll> v;
    rd(l,l);
    ll p=rd(l,l);
    if (p!=all)
    {
        for (ll i=l;i<=r;i++)
        {
            ll ne=rd(i,i);
            rd(i,i);
            if (ne==p-1)
            {
                all++;
                go(l,i-1),go(i+1,r);
                return;
            }
        }
        return;
    }
    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)
        {
            for (ll i=l;i<=r;i++)
            {
                ll ne=rd(i,i);
                rd(i,i);
                if (ne==p-1)
                {
                    all++;
                    go(l,i-1),go(i+1,r);
                    return;
                }
            }
            return;
        }
    }
}

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: 0ms
memory: 3388kb

input:

3
0
0
0
1
0
0
0
0
0
0
0
0
0

output:

1 1
1 1
1 2
1 2
1 1
1 1
2 2
2 2
2 2
2 2
3 3
3 3

result:

wrong answer format  Unexpected end of file - int32 expected