Submission #873945

#TimeUsernameProblemLanguageResultExecution timeMemory
873945Faisal_SaqibThe Collection Game (BOI21_swaps)C++17
25 / 100
50 ms1100 KiB
// // --- Sample implementation for the task swaps --- // // To compile this program with the sample grader, place: // swaps.h swaps_sample.cpp sample_grader.cpp // in a single folder and run: // g++ swaps_sample.cpp sample_grader.cpp // in this folder. // #include "swaps.h" #include <iostream> #include <set> #include <vector> using namespace std; int DNC(vector<int>& next) { if(next.size()==1) return next[0]; vector<int> fop; for(int i=0;(i+1)<next.size();i+=2) schedule(next[i],next[i+1]); auto pk=visit(); for(int i=0,j=0;i<next.size();i+=2,j++) { if((i+1)<next.size()) { if(pk[j]) fop.push_back(next[i]); else fop.push_back(next[i+1]); } else fop.push_back(next[i]); } return DNC(fop); } void solve(int n, int v) { vector<int> ap1; set<int> ful; for(int i=1;i<=n;i++) ful.insert(i); for(int i=1;i<=n;i++) { vector<int> ap; for(auto i:ful) ap.push_back(i); ap1.push_back(DNC(ap)); ful.erase(ap1.back()); } answer(ap1); }

Compilation message (stderr)

swaps.cpp: In function 'int DNC(std::vector<int>&)':
swaps.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;(i+1)<next.size();i+=2)
      |                 ~~~~~^~~~~~~~~~~~
swaps.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0,j=0;i<next.size();i+=2,j++)
      |                     ~^~~~~~~~~~~~
swaps.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         if((i+1)<next.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...