QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#482628 | #3097. Shopping | AdamGS | Compile Error | / | / | C++23 | 2.9kb | 2024-07-17 20:20:13 | 2024-07-17 20:20:14 |
Judging History
Anna
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
namespace {
int n, l, r, ile;
vector<int>pos;
vector<bool>bits;
void check() {
++ile;
int a=0, b=0;
rep(i, 20) if(bits[i]) a|=1<<i;
rep(i, 20) if(bits[i+20]) b|=1<<i;
vector<int>tmp;
bool zawiera=true;
rep(i, pos.size()) if((i<a || i>b) && (l<=pos[i] && pos[i]<=r)) zawiera=false;
if(zawiera) {
SendA(1);
rep(i, pos.size()) if(pos[a]<=pos[i] && pos[i]<=pos[b]) tmp.pb(pos[i]);
} else {
SendA(0);
rep(i, pos.size()) if(pos[a]>pos[i] || pos[i]>pos[b]) tmp.pb(pos[i]);
}
pos=tmp;
bits.clear();
}
}
void InitA(int _N, int _L, int _R) {
n=_N; l=_L; r=_R;
ile=0;
pos.clear();
bits.clear();
rep(i, n) pos.pb(i);
}
void ReceiveA(bool x) {
bits.pb(x);
if(bits.size()==40 && ile<18) check();
}
int Answer() {
vector<int>T;
rep(i, pos.size()) {
int x=0;
rep(j, 20) if(bits[i*20+j]) x|=1<<j;
T.pb(x);
}
pair<int,int>mi={n, n};
rep(i, pos.size()) if(l<=pos[i] && pos[i]<=r) mi=min(mi, {T[i], pos[i]});
return mi.nd;
}
Bruno
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
namespace {
const int LIM=1e6+7;
int lewo[LIM], prawo[LIM], odw[LIM], n, ile;
pair<int,int>xd;
vector<int>T, pos;
void send() {
int m=pos.size();
vector<pair<int,int>>P, S;
rep(i, m) {
lewo[i]=prawo[i]=i;
odw[i]=0;
P.pb({T[pos[i]], i});
}
sort(all(P));
reverse(all(P));
for(auto i : P) {
int l=i.nd, r=i.nd;
if(l && odw[l-1]) {
lewo[r]=lewo[l-1];
prawo[lewo[r]]=r;
l=lewo[r];
}
if(r<m-1 && odw[r+1]) {
prawo[l]=prawo[r+1];
lewo[prawo[l]]=l;
r=prawo[l];
}
odw[i.nd]=1;
S.pb({l, r});
}
pair<int,int>mi={LIM, LIM};
rep(i, m) {
int d=S[i].nd-S[i].st+1;
mi=min(mi, {max(d, (int)pos.size()-d), i});
}
xd=S[mi.nd];
rep(i, 20) if(S[mi.nd].st&(1<<i)) SendB(1); else SendB(0);
rep(i, 20) if(S[mi.nd].nd&(1<<i)) SendB(1); else SendB(0);
}
}
void InitB(int _N, vector<int>_T) {
n=_N; ile=0;
T=_T;
pos.clear();
rep(i, n) pos.pb(i);
send();
}
void ReceiveB(bool y) {
++ile;
vector<int>tmp;
if(y) {
rep(i, pos.size()) if(xd.st<=i && i<=xd.nd) tmp.pb(pos[i]);
} else {
rep(i, pos.size()) if(xd.st>i || i>xd.nd) tmp.pb(pos[i]);
}
pos=tmp;
if(ile<18) {
send();
return;
}
rep(i, pos.size()) {
rep(j, 20) if(T[pos[i]]&(1<<j)) SendB(1); else SendB(0);
}
}
Details
Anna.code: In function ‘int Answer()’: Anna.code:50:16: error: in C++98 ‘mi’ must be initialized by constructor, not by ‘{...}’ 50 | pair<int,int>mi={n, n}; | ^~ Anna.code:51:60: warning: extended initializer lists only available with ‘-std=c++11’ or ‘-std=gnu++11’ 51 | rep(i, pos.size()) if(l<=pos[i] && pos[i]<=r) mi=min(mi, {T[i], pos[i]}); | ^ Anna.code:51:74: warning: extended initializer lists only available with ‘-std=c++11’ or ‘-std=gnu++11’ 51 | rep(i, pos.size()) if(l<=pos[i] && pos[i]<=r) mi=min(mi, {T[i], pos[i]}); | ^ In file included from grader_Anna.cpp:2: testlib.h: In member function ‘std::vector<T> random_t::distinct(int, T, T)’: testlib.h:997:9: error: ‘uint64_t’ was not declared in this scope; did you mean ‘u_int64_t’? 997 | uint64_t n = to - from + 1; | ^~~~~~~~ | u_int64_t testlib.h:998:30: error: ‘n’ was not declared in this scope 998 | if (uint64_t(size) > n) | ^ testlib.h:1007:32: error: ‘n’ was not declared in this scope 1007 | expected += double(n) / double(n - i + 1); | ^ testlib.h:1009:31: error: ‘n’ was not declared in this scope 1009 | if (expected < double(n)) { | ^ grader_Anna.cpp: In function ‘int main(int, char**)’: grader_Anna.cpp:37:13: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] 37 | argv[2] = "/dev/null"; | ^~~~~~~~~~~