Submission #952546

#TimeUsernameProblemLanguageResultExecution timeMemory
952546SmuggingSpunUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms760 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); vector<int>restore_permutation(int n, int w, int r){ assert(n <= 32); if(n <= 32){ string s(n, '0'), current(n, '0'); for(int i = 0; i + 1 < n; i++){ s[i] = '1'; add_element(s); } compile_set(); vector<int>ans(n), p(n); iota(p.begin(), p.end(), 0); for(int i = 0; i < n; i++){ shuffle(p.begin(), p.end(), rng); int index = int(p.size()) - 1; for(int i = 0; i + 1 < p.size(); i++){ current[p[i]] = '1'; if(check_element(current)){ index = i; break; } current[p[i]] = '0'; } current[p[index]] = '1'; ans[p[index]] = i; p.erase(p.begin() + index); } return ans; } }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for(int i = 0; i + 1 < p.size(); i++){
      |                   ~~~~~~^~~~~~~~~~
messy.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
#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...