QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#178918 | #3097. Shopping | sjc061031# | Compile Error | / | / | C++20 | 2.1kb | 2023-09-14 15:27:34 | 2024-07-04 01:59:07 |
Judging History
Anna
#include <bits/stdc++.h>
using namespace std;
namespace{
int n,l,r,all,a[10010],d[100010];
}
void InitA(int N,int L,int R){
n=N;
l=L;
r=R;
if(n<=10000){
int posl=l/100;
int posr=r/100;
for(int i=0;i<9;i++){
if(posl&(1<<i)) SendA(1);
else SendA(0);
}
for(int i=0;i<9;i++){
if(posr&(1<<i)) SendA(1);
else SendA(0);
}
}
else{
}
}
void ReceiveA(bool x){
all++;
a[all]=x;
}
int Answer(){
if(n<=10000){
int posl=l/100,posr=r/100,tot=0,minv=n,pos=-1;
for(int i=posl;i<=posr;i++){
int L=i*100,R=min((i+1)*100-1,n);
if(i==posl||i==posr){
for(int j=L;j<=R;j++){
d[j]=0;
for(int k=0;k<20;k++){
tot++;
if(a[tot]) d[j]+=(1<<k);
}
}
for(int j=max(l,L);j<=min(r,R);j++){
if(d[j]<minv){
minv=d[j];pos=j;
}
}
}
else{
int loc=0;
for(int k=0;k<20;k++){
tot++;
if(a[tot]) loc+=(1<<k);
}
int cur=0;
for(int k=0;k<20;k++){
tot++;
if(a[tot]) cur+=(1<<k);
}
if(cur<minv){
minv=cur;pos=loc;
}
}
}
return pos;
}
else{
return l;
}
}
Bruno
#include <bits/stdc++.h>
using namespace std;
namespace{
int m,cnt,b[20],c[100010];
}
void InitB(int N,vector<int> P){
m=N;
for(int i=0;i<m;i++) c[i]=P[i];
}
void ReceiveB(bool y){
if(m<=10000){
cnt++;b[cnt]=y;
if(cnt==18){
int posl=0,posr=0;
for(int i=1;i<=9;i++) posl+=(1<<(i-1))*b[i];
for(int i=10;i<=18;i++) posr+=(1<<(i-10))*b[i];
for(int i=posl;i<=posr;i++){
int L=i*100,R=min((i+1)*100-1,m);
if(i==posl||i==posr){
for(int j=L;j<=R;j++){
for(int k=0;k<20;k++){
if(c[j]&(1<<k)) SendB(1);
else SendB(0);
}
}
}
else{
int minv=m,pos=-1;
for(int j=L;j<=R;j++) if(c[j]<minv){
minv=c[j];pos=j;
}
for(int k=0;k<20;k++){
if(pos&(1<<k)) SendB(1);
else SendB(0);
}
for(int k=0;k<20;k++){
if(c[pos]&(1<<k)) SendB(1);
else SendB(0);
}
}
}
}
}
else{
}
}
Details
Anna.code: In function ‘void InitA(int, int, int)’: Anna.code:16:20: error: ‘SendA’ was not declared in this scope 16 | if(posl&(1<<i)) SendA(1); | ^~~~~ Anna.code:17:9: error: ‘SendA’ was not declared in this scope 17 | else SendA(0); | ^~~~~ Anna.code:20:20: error: ‘SendA’ was not declared in this scope 20 | if(posr&(1<<i)) SendA(1); | ^~~~~ Anna.code:21:9: error: ‘SendA’ was not declared in this scope 21 | else SendA(0); | ^~~~~ grader_Anna.cpp: In function ‘int main(int, char**)’: grader_Anna.cpp:37:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 37 | argv[2] = "/dev/null"; | ^~~~~~~~~~~