QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#588877 | #6774. Ancient Machine 2 | Kevin5307 | 0 | 28ms | 4392kb | C++20 | 1.7kb | 2024-09-25 15:02:31 | 2024-09-25 15:02:31 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
#include"ancient2.h"
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
const int n=1000;
bitset<1005> bs[1005],bs2[1005];
bool ins(bitset<1005> b)
{
for(int i=0;i<n;i++)
if(b[i])
{
if(!bs[i][i])
{
bs[i]=b;
return true;
}
b^=bs[i];
}
return false;
}
int query(int N,int x,int y)
{
int M=x*2;
vector<int> A(M),B(M);
for(int i=0;i<x;i++)
for(int j=0;j<2;j++)
{
A[i*2+j]=((i+1)%x*2+j);
if(i==y)
B[i*2+j]=((i+1)%x*2+1-j);
else
B[i*2+j]=((i+1)%x*2+j);
}
return Query(M,A,B)&1;
}
string Solve(int N)
{
int tot=0;
for(int i=1;i<=N&&tot<N;i++)
for(int j=0;j<i&&tot<N;j++)
{
bitset<1005> b;
for(int k=0;k<N;k++)
if(k%i==j)
b[k]=1;
if(ins(b))
{
bs2[++tot]=b;
bs2[tot][N]=query(N,i,j);
}
}
for(int i=0;i<N;i++)
{
if(!bs2[i][i])
{
for(int j=i+1;j<N;j++)
if(bs2[j][i])
{
swap(bs2[i],bs2[j]);
break;
}
}
for(int j=0;j<N;j++)
if(i!=j&&bs2[j][i])
bs2[j]^=bs2[i];
}
string ret;
for(int i=0;i<N;i++)
ret+=(char)('0'+bs2[i][N]);
return ret;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 97
Acceptable Answer
time: 23ms
memory: 4312kb
input:
1000 1 0 3 2 1 0 1 1 1 0 8 8 12 12 13 13 12 12 1 0 1 0 2 3 3 2 3 3 0 0 0 0 21 21 21 21 20 20 21 20 20 21 8 9 8 8 24 24 25 24 25 25 24 24 25 25 24 24 12 12 13 13 12 13 20 21 21 20 21 20 21 21 16 16 17 16 17 17 17 17 28 28 29 29 28 29 29 29 29 29 28 28 28 29 28 28 21 21 20 20 20 21 24 25 24 25 25 25 2...
output:
Q 2 0 1 1 0 Q 4 2 3 0 1 3 2 0 1 Q 6 2 3 4 5 0 1 3 2 4 5 0 1 Q 6 2 3 4 5 0 1 2 3 5 4 0 1 Q 8 2 3 4 5 6 7 0 1 3 2 4 5 6 7 0 1 Q 8 2 3 4 5 6 7 0 1 2 3 5 4 6 7 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 3 2 4 5 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 5 4 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 4 5 7 6 8 9 0 1 Q 10 ...
result:
points 0.970 points 0.970 Accepted (partial scores)
Test #2:
score: 97
Acceptable Answer
time: 23ms
memory: 4392kb
input:
1000 0 1 2 2 0 1 0 1 0 0 9 9 12 13 12 12 13 13 1 1 1 1 2 3 3 3 3 3 1 0 1 0 20 20 21 20 21 21 21 21 20 20 8 9 9 8 25 25 25 25 24 24 24 25 25 25 25 25 13 12 12 12 12 12 21 21 20 21 21 21 20 20 17 17 17 17 16 17 16 17 28 28 29 28 28 29 28 28 28 28 29 29 29 28 29 28 21 21 20 21 21 21 25 24 25 24 25 24 2...
output:
Q 2 0 1 1 0 Q 4 2 3 0 1 3 2 0 1 Q 6 2 3 4 5 0 1 3 2 4 5 0 1 Q 6 2 3 4 5 0 1 2 3 5 4 0 1 Q 8 2 3 4 5 6 7 0 1 3 2 4 5 6 7 0 1 Q 8 2 3 4 5 6 7 0 1 2 3 5 4 6 7 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 3 2 4 5 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 5 4 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 4 5 7 6 8 9 0 1 Q 10 ...
result:
points 0.970 points 0.970 Accepted (partial scores)
Test #3:
score: 0
Wrong Answer
time: 28ms
memory: 4392kb
input:
1000 1 0 2 3 1 0 1 0 1 0 9 9 12 12 13 13 12 13 0 0 1 0 2 2 3 2 3 3 0 0 0 1 20 21 21 20 21 20 21 20 20 21 8 8 9 8 25 24 24 24 25 25 24 24 25 24 25 24 12 12 12 13 12 12 21 20 20 20 20 20 21 20 16 17 16 16 16 17 17 16 29 29 29 28 29 28 28 28 29 29 29 28 28 29 29 29 20 20 20 20 20 21 24 25 24 25 24 24 2...
output:
Q 2 0 1 1 0 Q 4 2 3 0 1 3 2 0 1 Q 6 2 3 4 5 0 1 3 2 4 5 0 1 Q 6 2 3 4 5 0 1 2 3 5 4 0 1 Q 8 2 3 4 5 6 7 0 1 3 2 4 5 6 7 0 1 Q 8 2 3 4 5 6 7 0 1 2 3 5 4 6 7 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 3 2 4 5 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 5 4 6 7 8 9 0 1 Q 10 2 3 4 5 6 7 8 9 0 1 2 3 4 5 7 6 8 9 0 1 Q 10 ...
result:
wrong answer Wrong Answer [3]