Submission #223648

#TimeUsernameProblemLanguageResultExecution timeMemory
223648DedMaximAliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
long long take_photos(int n, int m, int k, const std::vector<int>& r, const std::vector<int>& c) { std::vector<std::vector<bool>> used(m, std::vector<bool>(m, false)); for (int i = 0; i < n; ++i) { int left = r[i], right = c[i]; if (left > right) std::swap(left, right); for (int x = left; x <= right; ++x) { for (int y = left; y <= right; ++y) { used[x][y] = true; } } } long long result = 0; for (int x = 0; x != m; ++x) { for (int y = 0; y != m; ++y) { result += used[x][y]; } } return result; }

Compilation message (stderr)

aliens.cpp:1:55: error: 'vector' in namespace 'std' does not name a template type
 long long take_photos(int n, int m, int k, const std::vector<int>& r, const std::vector<int>& c) {
                                                       ^~~~~~
aliens.cpp:1:61: error: expected ',' or '...' before '<' token
 long long take_photos(int n, int m, int k, const std::vector<int>& r, const std::vector<int>& c) {
                                                             ^
aliens.cpp: In function 'long long int take_photos(int, int, int, int)':
aliens.cpp:2:10: error: 'vector' is not a member of 'std'
     std::vector<std::vector<bool>> used(m, std::vector<bool>(m, false));
          ^~~~~~
aliens.cpp:2:22: error: 'vector' is not a member of 'std'
     std::vector<std::vector<bool>> used(m, std::vector<bool>(m, false));
                      ^~~~~~
aliens.cpp:2:29: error: expected primary-expression before 'bool'
     std::vector<std::vector<bool>> used(m, std::vector<bool>(m, false));
                             ^~~~
aliens.cpp:5:20: error: 'r' was not declared in this scope
         int left = r[i], right = c[i];
                    ^
aliens.cpp:6:20: error: 'right' was not declared in this scope
         if (left > right)
                    ^~~~~
aliens.cpp:7:18: error: 'swap' is not a member of 'std'
             std::swap(left, right);
                  ^~~~
aliens.cpp:9:33: error: 'right' was not declared in this scope
         for (int x = left; x <= right; ++x) {
                                 ^~~~~
aliens.cpp:11:17: error: 'used' was not declared in this scope
                 used[x][y] = true;
                 ^~~~
aliens.cpp:19:23: error: 'used' was not declared in this scope
             result += used[x][y];
                       ^~~~