QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492400 | #4912. WereYouLast | Others | 10 | 1ms | 5108kb | C++14 | 1.2kb | 2024-07-26 11:56:46 | 2024-07-26 11:56:46 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
//#define int long long
#define wdnmd const int mod=::mod;
#define lb(i) ((i)&(-(i)))
#define wr(x,ch) write(x),putchar(ch)
using namespace std;
#define gh() getchar()
inline long long read(){
char ch=gh();
long long x=0;
char t=0;
while(ch<'0'||ch>'9') t|=ch=='-',ch=gh();
while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();
return t?-x:x;
}
void write(ll x) {
if(x<0) putchar('-'),x=-x;
if(x>=10) write(x/10);
putchar(x%10^48);
return ;
}
bool query(int);
void modify(int,bool);
bool WereYouLast(int n,int m) {
n=log2(n);
if(m==10) {
int a[10];
for(int i=0;i<10;i++) a[i]=query(i+1);
int t=0;
for(int i=0;i<10;i++) t|=(a[i]<<i);
if(t==1023) return 1;
for(int i=0;i<10;i++) {
if(!a[i]) {
modify(i+1,1);
break;
}
modify(i+1,0);
}
return 0;
}
int a[5];
for(int i=0;i<5;i++) a[i]=query(i+1);
int t=0;
for(int i=0;i<5;i++) t|=(a[i]<<i);
if(t==31) return 1;
if(t==n-1) {
for(int i=0;i<5;i++) modify(i+1,1);
return 0;
}
int p=query(t+6);
modify(t+6,p^1);
t=(p==0?0:t+1);
for(int i=0;i<5;i++) modify(i,t>>i&1);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3876kb
input:
1024 10
output:
12345876 10 10
result:
ok Correct Answer. C1 = 10. C2 = 10.
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 4944kb
input:
65536 100000
output:
12345876 -2 0
result:
wrong answer Invalid Operation At Position 0.
Subtask #3:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 5108kb
input:
1048576 100000
output:
12345876 -2 0
result:
wrong answer Invalid Operation At Position 0.
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 1ms
memory: 5036kb
input:
67108864 100000
output:
12345876 -2 0
result:
wrong answer Invalid Operation At Position 0.