Submission #569053

#TimeUsernameProblemLanguageResultExecution timeMemory
569053losmi247Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; typedef long long ll; int n,w,r; bool check_element(string x){ for(auto f : nv){ if(f == x) return 1; } return 0; } vector <int> prvi(){ add_element("11110000"); add_element("11000000"); add_element("00000011"); add_element("10000000"); add_element("00100000"); add_element("00001000"); add_element("00000010"); compile_set(); vector <int> ret(8,0); for(int i = 0; i < 8; i++) ret[i] = i; string s = "11110000"; for(int i = 0; i < 4; i++){ for(int j = 4; j < 8; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } s = "11000000"; for(int i = 0; i < 2; i++){ for(int j = 2; j < 4; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } s = "00000011"; for(int i = 4; i < 6; i++){ for(int j = 6; j < 7; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } //cout << "najmanji" << endl; s = "10000000"; for(int i = 0; i < 1; i++){ for(int j = 1; j < 2; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } s = "00100000"; for(int i = 2; i < 3; i++){ for(int j = 3; j < 4; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } s = "00001000"; for(int i = 4; i < 5; i++){ for(int j = 5; j < 6; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } s = "00000010"; for(int i = 6; i < 7; i++){ for(int j = 7; j < 8; j++){ string h = s; swap(h[i],h[j]); if(check_element(h)){ swap(ret[i],ret[j]); return ret; } } } return ret; } vector <int> restore_permutation(int N,int W,int R){ n = N; w = W; r = R; if(n == 8 && w == 256 && r == 256){ return prvi(); } }

Compilation message (stderr)

messy.cpp: In function 'bool check_element(std::string)':
messy.cpp:9:18: error: 'nv' was not declared in this scope; did you mean 'n'?
    9 |     for(auto f : nv){
      |                  ^~
      |                  n
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:126:1: warning: control reaches end of non-void function [-Wreturn-type]
  126 | }
      | ^