Submission #923694

#TimeUsernameProblemLanguageResultExecution timeMemory
923694alexddSuper Dango Maker (JOI22_dango3)C++17
0 / 100
2 ms604 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; int n,m; vector<int> ord; vector<int> favec(vector<int> cv, int mij) { vector<int> aux = cv; for(int j=0;j<=mij;j++) aux.push_back(ord[j]); return aux; } void scoate_unu() { int ult = ord.size(); vector<int> cv; for(int i=1;i<=n;i++) { int st,dr,mij,ans=ult-1; if(i==ult || !Query(favec(cv,mij-2))) ans=ult-1; else { st=0; dr=ult-1; while(st<=dr) { mij=(st+dr)/2; if(Query(favec(cv,mij))) { ans=mij; dr=mij-1; } else st=mij+1; } } cv.push_back(ord[ans]); ult=ans; ord.erase(ord.begin()+ans); } Answer(cv); } void Solve(int N, int M) { n=N; m=M; for(int i=1;i<=n*m;i++) ord.push_back(i); random_shuffle(ord.begin(),ord.end()); for(int i=1;i<m;i++) scoate_unu(); Answer(ord); } /** 3 2 3 3 1 2 1 2 */

Compilation message (stderr)

dango3.cpp: In function 'void scoate_unu()':
dango3.cpp:20:43: warning: 'mij' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         if(i==ult || !Query(favec(cv,mij-2)))
      |                                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...