Submission #52427

#TimeUsernameProblemLanguageResultExecution timeMemory
52427polyfishUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms512 KiB
//I love armpit fetish #include "messy.h" #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << '\n'; #define BP() cerr << "OK!\n"; #define PR(A, n) cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n'; #define PR0(A, n) cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n'; #define FILE_NAME "" void add(int l, int r, int n) { if (l==r) return; string s; for (int i=0; i<n; ++i) s += '0'; int mid = (l+r)/2; for (int i=l; i<=r; ++i) s[i] = '1'; for (int i=l; i<=mid; ++i) { s[i] = '0'; //cerr << s << '\n'; add_element(s); s[i] = '1'; } add(l, mid, n); add(mid+1, r, n); } void Find(int l, int r, int n, vector<int> p, vector<int> &res) { if (l==r) { res[p[0]] = l; return; } string s; vector<int> p1, p2; for (int i=0; i<n; ++i) s += '0'; for (int i=0; i<p.size(); ++i) s[p[i]] = '1'; for (int i=0; i<p.size(); ++i) { //cerr << p[i] << '\n'; s[p[i]] = '0'; //cerr << s << '\n'; if (check_element(s)) p1.push_back(p[i]); else p2.push_back(p[i]); s[p[i]] = '1'; } int mid = (l + r) / 2; Find(l, mid, n, p1, res); Find(mid+1, r, n, p2, res); } vector<int> restore_permutation(int n, int w, int r) { add(0, n-1, n); compile_set(); vector<int> p, res(n); for (int i=0; i<n; ++i) p.push_back(i); Find(0, n-1, n, p, res); return res; }

Compilation message (stderr)

messy.cpp: In function 'void Find(int, int, int, std::vector<int>, std::vector<int>&)':
messy.cpp:41:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<p.size(); ++i)
                   ~^~~~~~~~~
messy.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<p.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...