Submission #819524

#TimeUsernameProblemLanguageResultExecution timeMemory
819524AdamGSMinerals (JOI19_minerals)C++17
80 / 100
29 ms3052 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; int czy[2*LIM], lst=-1; bool pytaj(int x) { czy[x]^=1; int a=Query(x+1); swap(a, lst); return a!=lst; } void dc(vector<int>&X, vector<int>&Y) { if(X.size()==1) { Answer(X[0]+1, Y[0]+1); return; } vector<int>AX, AY, BX, BY; int mid=X.size()/2; rep(i, mid) { pytaj(X[i]); AX.pb(X[i]); } for(int i=mid; i<X.size(); ++i) BX.pb(X[i]); for(auto i : Y) { if(czy[X[0]]) { if(pytaj(i)) BY.pb(i); else AY.pb(i); } else { if(pytaj(i)) AY.pb(i); else BY.pb(i); } } dc(AX, AY); dc(BX, BY); } void Solve(int n) { vector<int>X, Y; rep(i, 2*n) { if(pytaj(i)) X.pb(i); else Y.pb(i); } dc(X, Y); }

Compilation message (stderr)

minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=mid; i<X.size(); ++i) BX.pb(X[i]);
      |                 ~^~~~~~~~~
#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...