Submission #207075

#TimeUsernameProblemLanguageResultExecution timeMemory
207075autumn_eelUnscrambling a Messy Bug (IOI16_messy)C++14
49 / 100
6 ms376 KiB
#include "messy.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef pair<int,int>P; vector<int> restore_permutation(int n, int w, int r) { if(n<=32){ rep(i,n){ string s; rep(j,n){ if(j<=i)s+='0'; else s+='1'; } add_element(s); } compile_set(); vector<int>v(n),p(n);//p[v[i]]=i mt19937 mt(12345); rep(i,n){ string s(n,'1'); rep(j,i)s[v[j]]='0'; vector<int>c; rep(j,n){ if(s[j]=='1')c.push_back(j); } shuffle(c.begin(),c.end(),mt); rep(k,c.size()){ int j=c[k]; if(s[j]=='0')continue; s[j]='0'; if(check_element(s)){ v[i]=j;break; } s[j]='1'; } } rep(i,n){ p[v[i]]=i; } return p; } return {}; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:3:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n)for(int i=0;i<(n);i++)
                              ^
messy.cpp:28:4: note: in expansion of macro 'rep'
    rep(k,c.size()){
    ^~~
#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...