Submission #346133

#TimeUsernameProblemLanguageResultExecution timeMemory
346133inwbearMinerals (JOI19_minerals)C++14
40 / 100
33 ms3052 KiB
#include "minerals.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define all(x) (x).begin(),(x).end() #define MEM(x,a) memset((x),a,sizeof((x))) #define F first #define S second #define imx INT_MAX const long long MOD = (long long)(1e9+7); const long long MMX = (long long)(1e18); typedef long long LL; typedef pair<int,int> pii; int ls,tp; vector<int>a,b; void find_ans(vector<int>A,vector<int>B) { int si=A.size(),ch,re; vector<int>na1,nb1,na2,nb2; if(A.size()==1) { Answer(A[0],B[0]); return; } for(int i=0;i<si/2;i++) { ch=Query(B[i]); nb1.pb(B[i]); } for(int i=(si/2);i<si;i++) { nb2.pb(B[i]); } for(int i=0;i<si;i++) { re=Query(A[i]); if(ch!=re) { na2.pb(A[i]); } else { na1.pb(A[i]); } Query(A[i]); } for(int i=0;i<si/2;i++) { ch=Query(B[i]); } find_ans(na1,nb1); find_ans(na2,nb2); return; } void Solve(int N) { for(int i=1;i<=2*N;i++) { tp=Query(i); if(tp!=ls) { a.pb(i); } else { b.pb(i); } ls=tp; } for(int i=1;i<=2*N;i++)Query(i); find_ans(a,b); return; }

Compilation message (stderr)

minerals.cpp: In function 'void find_ans(std::vector<int>, std::vector<int>)':
minerals.cpp:38:9: warning: 'ch' may be used uninitialized in this function [-Wmaybe-uninitialized]
   38 |         if(ch!=re)
      |         ^~
#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...