Submission #132736

#TimeUsernameProblemLanguageResultExecution timeMemory
132736wilwxkUnscrambling a Messy Bug (IOI16_messy)C++14
49 / 100
5 ms504 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; const int MAXN=2048; void adiciona(vector<int> &v) { string cur; for(int i=0; i<v.size(); i++) cur+=('0'+v[i]); add_element(cur); } bool checa(vector<int> &v) { string cur; for(int i=0; i<v.size(); i++) cur+=('0'+v[i]); return check_element(cur); } vector<int> restore_permutation(int n, int w, int r) { vector<int> conf, respf; respf.resize(n); for(int i=0; i<n; i++) conf.push_back(0); for(int i=0; i<n; i++) { conf[i]=1; adiciona(conf); } compile_set(); for(int i=0; i<n; i++) conf[i]=0; for(int i=0; i<n; i++) { bool ok=0; set<int> ruins; while(1) { int j=rand()%n; if(conf[j]||ruins.find(j)!=ruins.end()) continue; conf[j]=1; if(checa(conf)) { ok=1; respf[j]=i; break; } ruins.insert(j); conf[j]=0; } } return respf; }

Compilation message (stderr)

messy.cpp: In function 'void adiciona(std::vector<int>&)':
messy.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<v.size(); i++) cur+=('0'+v[i]);
               ~^~~~~~~~~
messy.cpp: In function 'bool checa(std::vector<int>&)':
messy.cpp:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<v.size(); i++) cur+=('0'+v[i]);
               ~^~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:29:11: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
      bool ok=0;
           ^~
#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...