Submission #717615

#TimeUsernameProblemLanguageResultExecution timeMemory
717615EntityPlanttMemory (IOI10_memory)C++14
Compilation error
0 ms0 KiB
#include "grader.h" #include "memory.h" #include <vector> void play() { vector <int> mem[25], i; for (i = 0; i < 50; i += 2) { char a = faceup(i), b = faceup(i + 1); mem[a - 'A'].push_back(i); mem[b - 'A'].push_back(i + 1); if (a == b) { mem[a - 'A'].clear(); } } for (i = 0; i < 25; i++) { if (mem[i]) { faceup(mem[i][0]); faceup(mem[i][1]); } } }

Compilation message (stderr)

memory.cpp: In function 'void play()':
memory.cpp:5:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |     vector <int> mem[25], i;
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from memory.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
memory.cpp:5:13: error: expected primary-expression before 'int'
    5 |     vector <int> mem[25], i;
      |             ^~~
memory.cpp:6:10: error: 'i' was not declared in this scope
    6 |     for (i = 0; i < 50; i += 2) {
      |          ^
memory.cpp:8:9: error: 'mem' was not declared in this scope
    8 |         mem[a - 'A'].push_back(i);
      |         ^~~
memory.cpp:9:13: error: 'b' was not declared in this scope
    9 |         mem[b - 'A'].push_back(i + 1);
      |             ^
memory.cpp:14:10: error: 'i' was not declared in this scope
   14 |     for (i = 0; i < 25; i++) {
      |          ^
memory.cpp:15:13: error: 'mem' was not declared in this scope
   15 |         if (mem[i]) {
      |             ^~~