Submission #1039536

#TimeUsernameProblemLanguageResultExecution timeMemory
103953612345678The Collection Game (BOI21_swaps)C++17
25 / 100
64 ms956 KiB
#include "swaps.h" #include <bits/stdc++.h> using namespace std; const int nx=505; int vs[nx]; int getmax(vector<int> qrs) { while (qrs.size()>1) { vector<int> nxt; if (qrs.size()%2) nxt.push_back(qrs.back()), qrs.pop_back(); for (int i=0; i<qrs.size(); i+=2) schedule(qrs[i], qrs[i+1]); auto v=visit(); for (int i=0; i<v.size(); i++) { if (v[i]) nxt.push_back(qrs[2*i]); else nxt.push_back(qrs[2*i+1]); } qrs=nxt; } return qrs[0]; } void solve(int N, int V) { vector<int> res; for (int i=1; i<=N; i++) { vector<int> qrs; for (int j=1; j<=N; j++) if (!vs[j]) qrs.push_back(j); auto tmp=getmax(qrs); //cout<<"debug "<<tmp<<'\n'; res.push_back(tmp); vs[tmp]=1; } answer(res); }

Compilation message (stderr)

swaps.cpp: In function 'int getmax(std::vector<int>)':
swaps.cpp:16:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for (int i=0; i<qrs.size(); i+=2) schedule(qrs[i], qrs[i+1]);
      |                       ~^~~~~~~~~~~
swaps.cpp:18:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int i=0; i<v.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...