Submission #44555

#TimeUsernameProblemLanguageResultExecution timeMemory
44555wzyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++11
Compilation error
0 ms0 KiB
#include <vector> int encode (int n, int x, int y) { vector<int> masks; for(int j = 0 ; j < (1<<12) ; j++){ int x = 0; for(int w = 0 ; w < 12 ; w++){ if(1<<w & j) x++; } if(x == 6) masks.push_back(j); } for(int j = 0 ; j < 12 ; j++){ if((mask[x] & 1 <<j) && !(mask[y] & 1<<j)){ return (j + 1); } } }
#include <vector> int decode (int n, int q, int h) { h--; vector<int> masks; for(int j = 0 ; j < (1<<12) ; j++){ int x = 0; for(int w = 0 ; w < 12 ; w++){ if(1<<w & j) x++; } if(x == 6) masks.push_back(j); } if(mask[q] & 1<<h){ return 1; } else return 0; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:3:2: error: 'vector' was not declared in this scope
  vector<int> masks;
  ^~~~~~
encoder.cpp:3:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from encoder.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
encoder.cpp:3:9: error: expected primary-expression before 'int'
  vector<int> masks;
         ^~~
encoder.cpp:9:14: error: 'masks' was not declared in this scope
   if(x == 6) masks.push_back(j);
              ^~~~~
encoder.cpp:12:7: error: 'mask' was not declared in this scope
   if((mask[x] & 1 <<j) && !(mask[y] & 1<<j)){
       ^~~~
encoder.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:4:2: error: 'vector' was not declared in this scope
  vector<int> masks;
  ^~~~~~
decoder.cpp:4:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from decoder.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
decoder.cpp:4:9: error: expected primary-expression before 'int'
  vector<int> masks;
         ^~~
decoder.cpp:10:14: error: 'masks' was not declared in this scope
   if(x == 6) masks.push_back(j);
              ^~~~~
decoder.cpp:12:5: error: 'mask' was not declared in this scope
  if(mask[q] & 1<<h){
     ^~~~
decoder.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^