Submission #1071753

#TimeUsernameProblemLanguageResultExecution timeMemory
1071753TimDeeShopping (JOI21_shopping)C++17
1 / 100
7 ms664 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0; i<n; ++i) int la, ra; void InitA(int n, int l, int r) { la = l, ra = r; forn(i,14) SendA((l>>i)&1); forn(i,4) SendA((r>>(i+10))&1); } int ai=-1; int mn = -1; void ReceiveA(bool x) { int b=x; if (ai==-1) { if (b) ++ai, mn=0; else ai=14; return; } if (ai<14) { mn+=b<<ai; ++ai; return; } if (la+ai-14 > ra) return; if (b) mn = la+ai-14; ++ai; } int Answer() { return mn; }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0; i<n; ++i) const int N=1e6+5; int a[N]; int n; void InitB(int n, vector<int> a) { forn(i,n) ::a[i]=a[i]; ::n=n; } int lq=0,rq=0; int bi=0; void ReceiveB(bool b) { int x = b; if (bi<14) { lq+=x<<bi; } else if (bi<18) { rq+=x<<(bi-4); } ++bi; if (bi==18) { int mn=-1; for(int i=lq; i<rq; ++i) { if (mn==-1) mn=i; if (a[i]<a[mn]) mn=i; } if (mn==-1) { SendB(0); } else { SendB(1); forn(i,14) SendB((mn>>i)&1); } for(int i=max(rq,lq); i<rq+1024; ++i) { if (mn==-1) mn=i; if (a[i]<a[mn]) mn=i; SendB(mn==i); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...