Submission #95198

#TimeUsernameProblemLanguageResultExecution timeMemory
95198someone_aaUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <vector> #include <bits/stdc++.h> #include "messy.h" using namespace std; int index[130]; bool taken[130]; std::vector<int> restore_permutation(int n, int w, int r) { string zeros; for(int i=0;i<n;i++) { zeros += "0"; } for(int i=1;i<n;i++) { string tmp = zeros; for(int j=1;j<=i;j++) { tmp[j-1] = '1'; } add_element(tmp); } compile_set(); vector<int>result(n, 0); string tmp = zeros; for(int i=1;i<=n;i++) { for(int j=0;j<n;j++) { if(!taken[j]) { tmp[j] = '1'; if(check_element(tmp)) { taken[j] = true; index[i] = j; result[j] = i-1; break; } else { tmp[j] = '0'; } } } } for(int i=0;i<result.size();i++) { if(!taken[i]) result[i] = n - 1; } return result; }

Compilation message (stderr)

messy.cpp:5:14: error: 'int index [130]' redeclared as different kind of symbol
 int index[130];
              ^
In file included from /usr/include/c++/7/cstring:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:48,
                 from messy.cpp:2:
/usr/include/string.h:477:1: note: previous declaration 'const char* index(const char*, int)'
 index (const char *__s, int __c) __THROW
 ^~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:35:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
                     index[i] = j;
                            ^
messy.cpp:46:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<result.size();i++) {
                 ~^~~~~~~~~~~~~~