Submission #940276

# Submission time Handle Problem Language Result Execution time Memory
940276 2024-03-07T07:26:24 Z HappyCapybara Memory (IOI10_memory) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
#include "memory.h"
#include<vector>
using namespace std;

void play() {
   vector<vector<int>> p(25);
   for (int i=1; i<=50; i++) p[faceup(i)-1].push_back(i);
   for (vector<int> v : p) faceup(p[1]); faceup(p[2]);
}

Compilation message

memory.cpp: In function 'void play()':
memory.cpp:9:39: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int'
    9 |    for (vector<int> v : p) faceup(p[1]); faceup(p[2]);
      |                                       ^
      |                                       |
      |                                       __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
In file included from memory.cpp:1:
grader.h:1:17: note:   initializing argument 1 of 'char faceup(int)'
    1 | char faceup(int C);
      |             ~~~~^
memory.cpp:9:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    9 |    for (vector<int> v : p) faceup(p[1]); faceup(p[2]);
      |    ^~~
memory.cpp:9:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    9 |    for (vector<int> v : p) faceup(p[1]); faceup(p[2]);
      |                                          ^~~~~~
memory.cpp:9:53: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int'
    9 |    for (vector<int> v : p) faceup(p[1]); faceup(p[2]);
      |                                                     ^
      |                                                     |
      |                                                     __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
In file included from memory.cpp:1:
grader.h:1:17: note:   initializing argument 1 of 'char faceup(int)'
    1 | char faceup(int C);
      |             ~~~~^