QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#253625#7804. Intersegment ActivationLynkcat#AC ✓0ms3660kbC++202.3kb2023-11-17 10:33:082023-11-17 10:33:08

Judging History

你现在查看的是测评时间为 2023-11-17 10:33:08 的历史记录

  • [2023-11-17 12:41:04]
  • 管理员手动重测该提交记录
  • 测评结果:AC
  • 用时:12ms
  • 内存:3932kb
  • [2023-11-17 10:33:08]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3660kb
  • [2023-11-17 10:33:08]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
// #define int ll
// #define N 
using namespace std;
int n;
int s[15],vis[15][15];
int rev(int x,int y)
{
    cout<<x<<" "<<y<<endl;
    if (vis[x][y]) 
    {
        vis[x][y]=0;
        for (int i=x;i<=y;i++) s[i]--;
    } else
    {
        vis[x][y]=1;
        for (int i=x;i<=y;i++) s[i]++;
    }
    int t=0;
    for (int i=1;i<=n;i++) if (s[i]==0) t++;
    cin>>t;
    if (t==n) exit(0);
    // cout<<"!!"<<t<<endl;
    return t;
}
poly gr(int x)
{
    if (x==1) return (poly){0,1};
    poly res=gr(x-1);
    poly res1=res;
    reverse(res1.begin(),res1.end());
    for (auto u:res1) res.push_back(u+(1<<(x-1)));
    return res;
}
mt19937_64 rnd(time(0));
void BellaKira()
{
    cin>>n;
    for (int t=1;t<=100;t++)
    {
        int x=rnd()%n+1,y=rnd()%n+1;
        if (x>y) swap(x,y);
        if (vis[x][y]) 
        {
            vis[x][y]=0;
            for (int i=x;i<=y;i++) s[i]--;
        } else
        {
            vis[x][y]=1;
            for (int i=x;i<=y;i++) s[i]++;
        }
    }
    int nw=0;
    for (int i=1;i<=n;i++) if (s[i]==0) nw++;
    cin>>nw;
    
    for (int i=1;i<=n;i++)
    {
        poly g=gr(n-i+1);
        int mn=nw,now=g[0];
        for (int j=1;j<g.size();j++)
        {
            int op;
            for (int k=0;k<n-i+1;k++)
                if ((g[j]>>k)%2!=(g[j-1]>>k)%2) 
                {
                    op=rev(i,i+k);
                }
            // cout<<"!!"<<g[j-1]<<","<<g[j]<<endl;
            if (op>mn) mn=op,now=g[j];
            nw=op;
        }
        now^=g.back();
        for (int k=0;k<n-i+1;k++)
            if ((now>>k)%2) 
            {
                nw=rev(i,i+k);
            }
    }
    // cout<<"???"<<nw<<endl;
    // assert(nw==n);
    


}
signed main()
{
    IOS;
    cin.tie(0);
    int T=1;
    while (T--)
    {
        BellaKira();
    }
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3660kb

input:

3
010
01
0

output:

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

result:

wrong output format Extra information in the output file