Submission #711423

#TimeUsernameProblemLanguageResultExecution timeMemory
711423Jovan26Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; #define pb push_back void display(vector<string> v){ for(auto u:v){ cout<<u<<" "; } cout<<endl; } std::vector<int> restore_permutation(int n, int w, int r) { // vector<string> v; int tr = 1; for(int i=0;i<n-1;i++){ string s = ""; for(int j=0;j<tr;j++){ s.pb('1'); } for(int j=tr;j<n;j++){ s.pb('0'); } //v.pb(s); add_element(s); tr++; } compile_set(); //cout<<'x'<<endl; int pp[n] = {}; for(int i=1;i<n;i++){ string s = ""; for(int j=0;j<n;j++) s.pb('1'); for(int j=0;j<n;j++){ if(pp[j]) s[j] = '0'; } vector<int> ind; for(int j=0;j<n;j++){ if(s[j]=='1') ind.pb(j); } for(int j=0;j<ind.size();j++){ s[ind[j]] = '0'; bool x = check_element(s); //if(i==1 && x) cout<<s<<endl; if(x){ pp[ind[j]] = n-i; break; } s[ind[j]] = '1'; } } //or(int i=0;i<n;i++) cout<<pp[i]<<" "; vector<int> p(n,0); //p.resize(n); for(int i=0;i<n;i++){ p[i] = pp[i]; } //display(p); return p; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for(int j=0;j<ind.size();j++){
      |                     ~^~~~~~~~~~~
#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...