Submission #1235178

#TimeUsernameProblemLanguageResultExecution timeMemory
1235178moondarksideUnscrambling a Messy Bug (IOI16_messy)C++20
Compilation error
0 ms0 KiB
void add_element(string x); void compile_set(); bool check_element(string x); void AddT(int pos,vector<bool>& Base,int n){ string test; for(int i=0;i<n;i++){ test+='0' + (Base[i] ^ (pos==i)); } add_element(test); } bool CheckT(int pos,vector<bool>& Base,int n){ string test; for(int i=0;i<n;i++){ test+='0' + (Base[i] ^ (pos==i)); } return check_element(test); } vector<int> restore_permutation(int n, int w, int r){ vector<bool> Base(n,false); for(int i=0;i<6;i++){ vector<bool> NewBase=Base; int mult=1<<i; for(int j=0;j<n;j++){ if((j & mult) !=0){ NewBase[j]=1; AddT(j,Base,n); } } Base=NewBase; } Base = vector<bool>(n,true); int mult=n/2; for(int j=0;j<n;j++){ if((j & mult) !=0){ AddT(j,Base,n); } } compile_set(); vector<int> Permutation(n,0); Base = vector<bool>(n,false); for(int i=0;i<6;i++){ vector<bool> NewBase=Base; int mult=1<<i; for(int j=0;j<n;j++){ if(CheckT(j,Base,n)){ NewBase[j]=1; Permutation[j]+=mult; } } Base=NewBase; } Base = vector<bool>(n,true); mult=n/2; for(int j=0;j<n;j++){ if(CheckT(j,Base,n)){ Permutation[j]+=mult; } } return Permutation; }

Compilation message (stderr)

messy.cpp:1:6: error: variable or field 'add_element' declared void
    1 | void add_element(string x);
      |      ^~~~~~~~~~~
messy.cpp:1:18: error: 'string' was not declared in this scope
    1 | void add_element(string x);
      |                  ^~~~~~
messy.cpp:3:20: error: 'string' was not declared in this scope
    3 | bool check_element(string x);
      |                    ^~~~~~
messy.cpp:5:19: error: 'vector' has not been declared
    5 | void AddT(int pos,vector<bool>& Base,int n){
      |                   ^~~~~~
messy.cpp:5:25: error: expected ',' or '...' before '<' token
    5 | void AddT(int pos,vector<bool>& Base,int n){
      |                         ^
messy.cpp: In function 'void AddT(int, int)':
messy.cpp:6:5: error: 'string' was not declared in this scope
    6 |     string test;
      |     ^~~~~~
messy.cpp:7:19: error: 'n' was not declared in this scope
    7 |     for(int i=0;i<n;i++){
      |                   ^
messy.cpp:8:9: error: 'test' was not declared in this scope
    8 |         test+='0' + (Base[i] ^ (pos==i));
      |         ^~~~
messy.cpp:8:22: error: 'Base' was not declared in this scope
    8 |         test+='0' + (Base[i] ^ (pos==i));
      |                      ^~~~
messy.cpp:10:17: error: 'test' was not declared in this scope
   10 |     add_element(test);
      |                 ^~~~
messy.cpp:10:5: error: 'add_element' was not declared in this scope; did you mean 'check_element'?
   10 |     add_element(test);
      |     ^~~~~~~~~~~
      |     check_element
messy.cpp: At global scope:
messy.cpp:14:21: error: 'vector' has not been declared
   14 | bool CheckT(int pos,vector<bool>& Base,int n){
      |                     ^~~~~~
messy.cpp:14:27: error: expected ',' or '...' before '<' token
   14 | bool CheckT(int pos,vector<bool>& Base,int n){
      |                           ^
messy.cpp: In function 'bool CheckT(int, int)':
messy.cpp:15:5: error: 'string' was not declared in this scope
   15 |     string test;
      |     ^~~~~~
messy.cpp:16:19: error: 'n' was not declared in this scope
   16 |     for(int i=0;i<n;i++){
      |                   ^
messy.cpp:17:9: error: 'test' was not declared in this scope
   17 |         test+='0' + (Base[i] ^ (pos==i));
      |         ^~~~
messy.cpp:17:22: error: 'Base' was not declared in this scope
   17 |         test+='0' + (Base[i] ^ (pos==i));
      |                      ^~~~
messy.cpp:19:26: error: 'test' was not declared in this scope
   19 |     return check_element(test);
      |                          ^~~~
messy.cpp:19:30: error: 'check_element' cannot be used as a function
   19 |     return check_element(test);
      |                              ^
messy.cpp: At global scope:
messy.cpp:22:1: error: 'vector' does not name a type
   22 | vector<int> restore_permutation(int n, int w, int r){
      | ^~~~~~
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~