Submission #794176

# Submission time Handle Problem Language Result Execution time Memory
794176 2023-07-26T10:17:32 Z alvingogo Toy Train (IOI17_train) C++14
Compilation error
0 ms 0 KB
#include "train.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;

typedef long long ll;
const ll inf=1e9;
void print(auto& a){
	return;
	for(auto h:a){
		cerr << h << " ";
	}
	cerr << "\n";
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n=a.size(),m=u.size();
	vector<int> ans(n);
	vector<vector<int> > e(n);
	for(int i=0;i<m;i++){
		e[u[i]].push_back(e[i]);
	}
	for(int i=n-1;i>=0;i--){
		int mx=0,mn=1;
		for(auto y:e[i]){
			if(y==i){
				if(r[i]==1){
					mx=1;
				}
				else{
					mn=0;
				}
			}
			else{
				mx=max(mx,ans[y]);
				mn=mn(mn,ans[y]);
			}
		}
		if(a[i]==0){
			ans[i]=mn;
		}
		else{
			ans[i]=mx;
		}
	}
	return ans;
}

Compilation message

train.cpp:12:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   12 | void print(auto& a){
      |            ^~~~
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:24:25: error: no matching function for call to 'std::vector<int>::push_back(__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&)'
   24 |   e[u[i]].push_back(e[i]);
      |                         ^
In file included from /usr/include/c++/10/vector:67,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
train.cpp:39:20: error: 'mn' cannot be used as a function
   39 |     mn=mn(mn,ans[y]);
      |                    ^