Submission #58583

#TimeUsernameProblemLanguageResultExecution timeMemory
58583radoslav11Unscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
3 ms512 KiB
#include <bits/stdc++.h> #include "messy.h" //#include "Lgrader.cpp" using namespace std; template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const int MAXN = (1 << 20); int n; void prec(int l, int r) { if(l == r) return; int mid = (l + r) >> 1; for(int i = l; i <= mid; i++) { string s(::n, '0'); for(int j = l; j <= r; j++) s[j] = '1'; s[i] = '0'; add_element(s); } prec(l, mid); prec(mid + 1, r); } void get(int l, int r, vector<int> cands, vector<int> &ret) { if(l == r) { ret[l] = cands.back(); return; } vector<int> L, R; int mid = (l + r) >> 1; for(int i: cands) { string s(::n, '0'); for(int j: cands) s[j] = '1'; s[i] = '0'; if(check_element(s)) L.push_back(i); else R.push_back(i); } assert(cands.size() == (r - l + 1)); get(l, mid, L, ret); get(mid + 1, r, R, ret); } vector<int> restore_permutation(int n, int w, int r) { ::n = n; string tmp(n, '0'); prec(0, n - 1); compile_set(); vector<int> ret(n, 0); vector<int> cands(n, 0); for(int i = 0; i < n; i++) cands[i] = i; get(0, n - 1, cands, ret); return ret; }

Compilation message (stderr)

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from messy.cpp:1:
messy.cpp: In function 'void get(int, int, std::vector<int>, std::vector<int>&)':
messy.cpp:57:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(cands.size() == (r - l + 1));
         ~~~~~~~~~~~~~^~~~~~~~~~~~~~
#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...