Submission #830130

#TimeUsernameProblemLanguageResultExecution timeMemory
830130LiudasUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms512 KiB
#include <vector> #include <cstdio> #include <string> #include <set> #include <cstdlib> #include <iostream> #include "messy.h" #include <numeric> #include <algorithm> #include <random> #include <chrono> using namespace std; vector<int> ans; void prec(vector<int> in, vector<int> out){ if(in.size() % 2) return; string s = string(in.size() + out.size(), '0'); vector<int> l, r, ll = out, rr = out; for(int i : out){ s[i] = '1'; } for(int i = 0; i < in.size()/2; i ++){ s[in[i]] = '1'; l.push_back(in[i]); r.push_back(in[i+in.size()/2]); ll.push_back(in[i]); rr.push_back(in[i+in.size()/2]); add_element(s); s[in[i]] = '0'; } prec(l, rr); prec(r, ll); } void comp(vector<int> in, vector<int> out, int L){ if(in.size() % 2){ ans[in[0]] = L; return; } string s = string(in.size() + out.size(), '0'); for(int i : out){ s[i] = '1'; } vector<int> l, r, ll = out, rr = out; for(int i : in){ s[i] = '1'; if(check_element(s)){ l.push_back(i); ll.push_back(i); } else{ r.push_back(i); rr.push_back(i); } s[i] = '0'; } comp(l, rr, L); comp(r, ll, L + in.size() / 2); } vector<int> restore_permutation(int N, int W, int R){ vector<int> arr(N), brr; iota(arr.begin(), arr.end(), 0); prec(arr, brr); compile_set(); ans.resize(N); comp(arr, brr, 0); return ans; }

Compilation message (stderr)

messy.cpp: In function 'void prec(std::vector<int>, std::vector<int>)':
messy.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i = 0; i < in.size()/2; 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...