Submission #295913

# Submission time Handle Problem Language Result Execution time Memory
295913 2020-09-10T06:00:46 Z Muhammetali Toy Train (IOI17_train) C++11
Compilation error
0 ms 0 KB
#include "train.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
const int N=2e5+1;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v)
{
	vi res;
	ll mx=0;
	for (int i=0;i<sz(u);i++)
	{
		if (u[i]==v[i] && a[u[i]]==1 && r[u[i]]==1)
		{
			mx=max(mx,i);
		}
	}
	for (int i=0;i<sz(a);i++)
	{
		if (mx>=i)
		{
			res.pb(1);
		}
		else
		{
			res.pb(0);
		}
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:35:15: error: no matching function for call to 'max(ll&, int&)'
   35 |    mx=max(mx,i);
      |               ^
In file included from /usr/include/c++/9/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
train.cpp:35:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |    mx=max(mx,i);
      |               ^
In file included from /usr/include/c++/9/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
train.cpp:35:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |    mx=max(mx,i);
      |               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from train.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
train.cpp:35:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |    mx=max(mx,i);
      |               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from train.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
train.cpp:35:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |    mx=max(mx,i);
      |               ^