답안 #424692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
424692 2021-06-12T09:12:33 Z TryMax Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include <bits/stdc++.h>
#ifdef LOCAL
    #include "grader.cpp"
#endif // LOCAL

#define pb push_back

const int N = 1e5 + 10;

int n, m, k;

int dist(int x, int y, int x1, int y1){
    return abs(x - x1) + abs(y - y1);
}

int pos(int x, int y){
    return x * m + y;
}

void construct_network(int N, int M, int K){
    n = N;
    m = M;
    k = K;
    int last = 0;
	for(int i = 0; i < n; ++i)
        for(int j = 0; j < m; ++j)
            for(int i1 = i; i1 < n; ++i1)
                for(int j1 = 0; j1 < m; ++j1)
                    if(dist(i, j, i1, j1) == k){
                        vector<int> q;
                        q.pb(pos(i, j));
                        q.pb(pos(i1, j1));
                        last = add_and(q);
                    }
    vector<int> q;
    for(int i = N * M; i <= last; ++i)
        q.pb(i);
    add_or(q);
}
/*
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
*/

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:31:25: error: 'vector' was not declared in this scope
   31 |                         vector<int> q;
      |                         ^~~~~~
vision.cpp:31:25: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
vision.cpp:31:32: error: expected primary-expression before 'int'
   31 |                         vector<int> q;
      |                                ^~~
vision.cpp:32:25: error: 'q' was not declared in this scope
   32 |                         q.pb(pos(i, j));
      |                         ^
vision.cpp:36:5: error: 'vector' was not declared in this scope
   36 |     vector<int> q;
      |     ^~~~~~
vision.cpp:36:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
vision.cpp:36:12: error: expected primary-expression before 'int'
   36 |     vector<int> q;
      |            ^~~
vision.cpp:38:9: error: 'q' was not declared in this scope
   38 |         q.pb(i);
      |         ^
vision.cpp:39:12: error: 'q' was not declared in this scope
   39 |     add_or(q);
      |            ^