Submission #1074064

# Submission time Handle Problem Language Result Execution time Memory
1074064 2024-08-25T07:31:16 Z 1ne Wombats (IOI13_wombats) C++14
Compilation error
0 ms 0 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
struct node{
  int x,y,d;
};
vector<vector<node>>adj;
int dist1[200][5000][200];
int dist2[200][5000][200];
int n,m;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
    /* ... */
    n = R,m = C:
    adj.resize(R,vector<node>(C));
    for (int i = 0;i<R;++i){
    	for (int j = 0;j<C - 1;++j){
    		adj[i][j].push_back({i,j + 1,H[i][j]});
    		adj[i][j + 1].push_back({i,j,H[i][j]});
    	}
    }
    for (int i = 0;i<R - 1;++i){
    	for (int j = 0;j<C;++j){
    		adj[i][j].push_back({i + 1,j,V[i][j]});
    		adj[i + 1][j].push_back({i,j,V[i][j]});
    	}
    }
    for (int i = 0;i<200;++i){
    	for (int j = 0;j<5000;++j){
    		for (int k = 0;k<200;++k){
    			dist[i][j][k] = 1e9;
    		}
    	}
    }
	for (int i = 0;i<C;++i){
		queue<pair<int,int>>q;
		q.push({0,i});
		dist1[i][0][i] = 0;
		while(!q.empty()){
			auto u = q.front();
			q.pop();
			for (auto x:adj[u.first][u.second]){
				if (dist1[i][x.x][x.y] > dist1[i][u.first][u.second] + x.d){
					dist1[i][x.x][x.y] = dist1[i][u.first][u.second] + x.d;
					q.push({x.x,x.y});
				}	
			}
		}
	}
	for (int i = 0;i<C;++i){
		queue<pair<int,int>>q;
		q.push({R - 1,i});
		dist2[i][R - 1][i] = 0;
		while(!q.empty()){
			auto u = q.front();
			q.pop();
			for (auto x:adj[u.first][u.second]){
				if (dist2[i][x.x][x.y] > dist2[i][u.first][u.second] + x.d){
					dist2[i][x.x][x.y] = dist2[i][u.first][u.second] + x.d;
					q.push({x.x,x.y});
				}	
			}
		}
	}
}

void changeH(int P, int Q, int W) {
    /* ... */
}

void changeV(int P, int Q, int W) {
    /* ... */
}

int escape(int V1, int V2) {
	return dist1[V1][m - 1][V2];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
wombats.cpp: In function 'void init(int, int, int (*)[200], int (*)[200])':
wombats.cpp:13:16: error: found ':' in nested-name-specifier, expected '::'
   13 |     n = R,m = C:
      |                ^
      |                ::
wombats.cpp:13:15: error: 'C' is not a class, namespace, or enumeration
   13 |     n = R,m = C:
      |               ^
wombats.cpp:17:17: error: '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type' {aka 'struct node'} has no member named 'push_back'
   17 |       adj[i][j].push_back({i,j + 1,H[i][j]});
      |                 ^~~~~~~~~
wombats.cpp:18:21: error: '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type' {aka 'struct node'} has no member named 'push_back'
   18 |       adj[i][j + 1].push_back({i,j,H[i][j]});
      |                     ^~~~~~~~~
wombats.cpp:23:17: error: '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type' {aka 'struct node'} has no member named 'push_back'
   23 |       adj[i][j].push_back({i + 1,j,V[i][j]});
      |                 ^~~~~~~~~
wombats.cpp:24:21: error: '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type' {aka 'struct node'} has no member named 'push_back'
   24 |       adj[i + 1][j].push_back({i,j,V[i][j]});
      |                     ^~~~~~~~~
wombats.cpp:30:8: error: 'dist' was not declared in this scope; did you mean 'dist2'?
   30 |        dist[i][j][k] = 1e9;
      |        ^~~~
      |        dist2
wombats.cpp:41:37: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   41 |    for (auto x:adj[u.first][u.second]){
      |                                     ^
      |                                     std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wombats.cpp:2:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
wombats.cpp:41:37: error: 'end' was not declared in this scope; did you mean 'std::end'?
   41 |    for (auto x:adj[u.first][u.second]){
      |                                     ^
      |                                     std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wombats.cpp:2:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
wombats.cpp:44:22: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   44 |      q.push({x.x,x.y});
      |                      ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from wombats.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
wombats.cpp:56:37: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   56 |    for (auto x:adj[u.first][u.second]){
      |                                     ^
      |                                     std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wombats.cpp:2:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
wombats.cpp:56:37: error: 'end' was not declared in this scope; did you mean 'std::end'?
   56 |    for (auto x:adj[u.first][u.second]){
      |                                     ^
      |                                     std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wombats.cpp:2:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
wombats.cpp:59:22: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   59 |      q.push({x.x,x.y});
      |                      ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from wombats.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~