QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#666860 | #9518. 观虫我 (旧版数据) | lichenghan | 0 | 128ms | 15332kb | C++14 | 2.9kb | 2024-10-22 20:14:02 | 2024-10-22 21:32:21 |
Judging History
answer
#include <bits/stdc++.h>
#define ui unsigned
#define ull ui long long
using namespace std;
#define USE_FREAD_FWRITE
#define READ_NEGATIVE
#define WRITE_NEGATIVE
#define DEFAULT_TYPE int
namespace IO{
#ifdef USE_FREAD_FWRITE
#define SIZE (1<<20)
char in[SIZE],out[SIZE],*p1=in,*p2=in,*p3=out;
char getchar(){ return p1==p2&&(p2=(p1=in)+fread(in,1,SIZE,stdin),p1==p2)?EOF:*p1++; }
void flush(){ int len=p3-out; fwrite(p3=out,1,len,stdout); }
void putchar(char ch){ if(p3==out+SIZE)flush(); *p3++=(ch); }
struct Flush{~Flush(){flush();}}_;
#else
char getchar(){ return ::getchar(); }
void putchar(char ch){ ::putchar(ch); }
void flush(){}
#endif
template<typename type=DEFAULT_TYPE> inline type read(){
#ifdef READ_NEGATIVE
type x(0);bool flag(0);char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar())flag^=ch=='-';
for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
return flag?-x:x;
#else
type x(0);char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar());
for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
return x;
#endif
}
template<typename type>
inline void write(type x){
#ifdef WRITE_NEGATIVE
if(x<0)x=-x,putchar('-');
#endif
static int Stack[50],top(0);
do Stack[++top]=x%10,x/=10;while(x);
while(top) putchar(Stack[top--]|48);
}
}
using IO::read;
using IO::write;
const int N=1e6+10;
mt19937 rnd(0);
// mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n,m;
ui op[N],at[N];
char conf[32];
void get_conf(){
static char tmp[32];
long long tc=1e18,tt=0;
while(tc>=7e8){
ui sa=0,sb=0,sc=0;
for(int i=6;i<32;i++){
tmp[i]="abc"[rnd()%3];
if(tmp[i]=='a') sa|=(1u<<i);
if(tmp[i]=='b') sb|=(1u<<i);
if(tmp[i]=='c') sc|=(1u<<i);
}
tt=0;
for(int i=1;i<=m;i++){
tt+=1<<__builtin_popcount(op[i]?(~at[i])&sc|at[i]&sa:(~at[i])&sb|at[i]&sc);
}
if(tt<=tc){
// fprintf(stderr,"%s %lld\n",tmp+6,tt);
tc=tt;
memcpy(conf,tmp,sizeof(conf));
}
}
// cerr<<"TC: "<<tc<<endl;
}
ull a[1<<26];
void change(ui x){
ui y=x&63;
ull s=0;
for(int i=63;i>=0;i--) s=(s<<1)|((i&y)==y);
ui z=0;
for(int i=6;i<32;i++){
if(conf[i]=="bc"[x>>i&1]){
z|=(1u<<i);
}
}
x>>=6; z>>=6;
// for(ui i=z;;i=(i-1)&z){
// // printf("c %d\n",x^i);
// a[x^i]^=s;
// if(!i) break;
// }
}
bool query(ui x){
ui y=x&63;
ui z=0;
for(int i=6;i<32;i++){
if(conf[i]=="ca"[x>>i&1]){
z|=(1u<<i);
}
if(conf[i]=='c'){
x^=(1u<<i);
}
}
x>>=6; z>>=6;
ull ans=0;
// for(ui i=z;;i=(i-1)&z){
// // printf("q %d\n",x^i);
// ans^=a[x^i];
// if(!i) break;
// }
return (ans>>y)&1;
}
int main(){
n=read(); m=read();
for(int i=1;i<=m;i++){
char o; do o=IO::getchar(); while(o!='!'&&o!='?');
const ui x=read();
op[i]=(o=='?'); at[i]=x;
}
get_conf();
for(int i=1;i<=m;i++){
if(op[i]){
IO::putchar('0'+query(at[i])); IO::putchar('\n');
}else{
change(at[i]);
}
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 84ms
memory: 14876kb
input:
24 1000000 ! 9475137 ! 4501536 ? 14277831 ? 16695039 ? 5723102 ? 6093887 ? 3014539 ! 475969 ? 12500973 ! 8750136 ? 15617895 ! 4589313 ! 152300 ? 3612579 ? 15248179 ! 764162 ! 4461105 ? 7274495 ? 13299697 ! 8388872 ? 13490383 ! 3875594 ! 9439685 ? 16776189 ! 6443172 ? 13864879 ! 395691 ? 7142271 ? 16...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer Wrong answer at operation #3: Incorrect answer.
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 128ms
memory: 15332kb
input:
26 1000000 ! 18006034 ? 66957270 ! 2133064 ! 147618 ! 34621442 ? 49715575 ? 62879287 ! 18620682 ? 67073751 ! 62941186 ! 7634532 ? 67100031 ? 12517237 ! 4804997 ? 65991126 ! 138275 ? 65722687 ? 66043391 ! 19147234 ? 45743743 ! 2242648 ! 44378336 ? 48226020 ! 34341926 ! 665045 ? 55433083 ! 5554254 ? 4...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer Wrong answer at operation #12: Incorrect answer.
Subtask #3:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 76ms
memory: 13712kb
input:
28 1000000 ! 1081468 ! 128476263 ! 67930241 ? 94304031 ! 103698752 ! 19982 ! 198050624 ? 249519591 ? 71286719 ? 255700799 ! 103309888 ! 819340 ! 12852092 ? 124739445 ? 192734967 ! 101320328 ! 117594711 ? 252032927 ! 134267948 ? 262940285 ! 3155972 ? 267876218 ! 41984160 ? 246413294 ? 246824252 ? 163...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer Wrong answer at operation #9: Incorrect answer.
Subtask #4:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 87ms
memory: 13992kb
input:
30 1000000 ! 33852274 ? 1017904007 ? 1046413001 ! 151029382 ? 466826079 ? 250568375 ! 6769874 ! 2106474 ? 536832803 ? 209627867 ! 167104971 ? 1048372157 ! 245380745 ! 25174496 ? 819646460 ! 539548800 ! 671358165 ? 402955591 ? 527753201 ! 582494209 ? 862862931 ? 938974695 ? 263672827 ? 366968669 ? 87...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer Wrong answer at operation #26: Incorrect answer.
Subtask #5:
score: 0
Time Limit Exceeded
Test #41:
score: 0
Time Limit Exceeded
input:
32 1000000 ! 2474971548 ! 348268033 ? 1055293046 ? 3382525679 ? 1805515707 ? 3210332902 ? 2805668987 ? 4025974780 ! 2217771280 ! 176949664 ! 4213841344 ! 1477473321 ? 3150869759 ? 2127418041 ! 1610631720 ! 3624477314 ! 2288149532 ! 70909964 ! 40117153 ! 1343751456 ? 3758095615 ! 513059275 ! 31956816...