QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#253625 | #7804. Intersegment Activation | Lynkcat# | AC ✓ | 0ms | 3660kb | C++20 | 2.3kb | 2023-11-17 10:33:08 | 2023-11-17 10:33:08 |
Judging History
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
...
*/
Details
Tip: Click on the bar to expand more detailed information
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