Submission #602747

# Submission time Handle Problem Language Result Execution time Memory
602747 2022-07-23T10:57:31 Z misteg168 Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"
#include <bits/stdc++.h>
typedef ll long long;

ll dist(ll a, ll b,ll W){
	return abs(a%W-b%W) + abs(a/W-b/W);
}

void construct_network(int H, int W, int K) {
	vector<int> Ns;
	ll it = 0;
	for(int i = 0; i < W*H){
		for(int j = 0; j < W*H; j++){
			if(dist(i, j) == k) add_and({i, j}), it++;
		}
	}
	for(int i = H*W; i < H*W+it; i++) NS.push_back(i);
	add_or(NS);
	
}

Compilation message

vision.cpp:3:9: error: 'll' does not name a type; did you mean 'kill'?
    3 | typedef ll long long;
      |         ^~
      |         kill
vision.cpp:5:1: error: 'll' does not name a type; did you mean 'kill'?
    5 | ll dist(ll a, ll b,ll W){
      | ^~
      | kill
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:10:2: error: 'vector' was not declared in this scope
   10 |  vector<int> Ns;
      |  ^~~~~~
vision.cpp:10:2: 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:10:9: error: expected primary-expression before 'int'
   10 |  vector<int> Ns;
      |         ^~~
vision.cpp:11:2: error: 'll' was not declared in this scope
   11 |  ll it = 0;
      |  ^~
vision.cpp:12:24: error: expected ';' before ')' token
   12 |  for(int i = 0; i < W*H){
      |                        ^
      |                        ;
vision.cpp:14:7: error: 'dist' was not declared in this scope
   14 |    if(dist(i, j) == k) add_and({i, j}), it++;
      |       ^~~~
vision.cpp:14:21: error: 'k' was not declared in this scope
   14 |    if(dist(i, j) == k) add_and({i, j}), it++;
      |                     ^
vision.cpp:14:41: error: 'it' was not declared in this scope; did you mean 'i'?
   14 |    if(dist(i, j) == k) add_and({i, j}), it++;
      |                                         ^~
      |                                         i
vision.cpp:17:27: error: 'it' was not declared in this scope; did you mean 'i'?
   17 |  for(int i = H*W; i < H*W+it; i++) NS.push_back(i);
      |                           ^~
      |                           i
vision.cpp:17:36: error: 'NS' was not declared in this scope
   17 |  for(int i = H*W; i < H*W+it; i++) NS.push_back(i);
      |                                    ^~
vision.cpp:18:9: error: 'NS' was not declared in this scope
   18 |  add_or(NS);
      |         ^~