Submission #819426

#TimeUsernameProblemLanguageResultExecution timeMemory
819426AdamGSMinerals (JOI19_minerals)C++17
75 / 100
26 ms2816 KiB
#include "minerals.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #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() const int LIM=5e4+7; vector<int>T, zapalone; int czy[LIM], lst=-1; bool pytaj(int x) { int a=Query(x+1); swap(a, lst); return a!=lst; } void dc(int l, int r, vector<int>&V) { if(l==r) { Answer(T[l]+1, V[0]+1); return; } int mid=(l+r)/2; vector<int>tmp; for(auto i : zapalone) { if(i<l || i>mid) { pytaj(T[i]); czy[i]=0; } else tmp.pb(i); } zapalone=tmp; for(int i=l; i<=mid; ++i) if(!czy[i]) { pytaj(T[i]); zapalone.pb(i); czy[i]=1; } vector<int>A, B; for(auto i : V) { if(pytaj(i)) B.pb(i); else A.pb(i); } dc(l, mid, A); dc(mid+1, r, B); } void Solve(int n) { vector<int>V; rep(i, 2*n) { if(pytaj(i)) T.pb(i); else V.pb(i); } rep(i, T.size()) { zapalone.pb(i); czy[i]=1; } dc(0, n-1, V); }

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
minerals.cpp:50:2: note: in expansion of macro 'rep'
   50 |  rep(i, T.size()) {
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...