Submission #124743

#TimeUsernameProblemLanguageResultExecution timeMemory
124743arthurconmySalesman (IOI09_salesman)C++14
Compilation error
0 ms0 KiB
// check ctrl+v :^)
/* Arthur Conmy IOI template - minimal! */
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int,int>;
#define ff first
#define ss second
#define REP(i,a,b) \
for(int i = int(a); i<=int(b); i++)

int n,u,d,s;
ll st[2][1048576]; // first is up, second is down monkaS for memory again!
ll dp[500001];

int query(int l, int r, int tree)
{
	int ans=0;
	l+=1048576;
	r+=1048576;
	l--;
	r--;

	while(l<=r) // we know there's inequality in the case of the query RMQ(i,i)
	{
		if(l%2 == 1)
		{
			ans=max(ans,st[tree][l++]);
		}

		if(r%2 == 1)
		{
			ans=max(ans,st[tree][r--]);
		}

		l/=2;
		r/=2;
	}

	return ans;
}

void update(int pos, int new_val, int tree)
{
	pos+=1048576;
	pos--;
	st[tree][pos]=max(st[tree][pos],new_val);
	pos/=2;

	while(pos>0)
	{
		st[tree][pos] = max(st[tree][pos+pos],st[tree][pos+pos+1]);
		pos/=2;
	}
}

int main()
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	cin>>n>>u>>d>>s;

	vector<tuple<int,int,int>> fairs;

	REP(i,1,n)
	{
		int t,l,m;
		cin>>t>>l>>m;
		fairs.pb({t,l,m});
	}

	sort(fairs.begin(),fairs.end());

	REP(i,0,1000000)
	{
		st[0][i]+=i;
	}
}

Compilation message (stderr)

salesman.cpp: In function 'int query(int, int, int)':
salesman.cpp:41:29: error: no matching function for call to 'max(int&, ll&)'
    ans=max(ans,st[tree][l++]);
                             ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
salesman.cpp:41:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    ans=max(ans,st[tree][l++]);
                             ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
salesman.cpp:41:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    ans=max(ans,st[tree][l++]);
                             ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
salesman.cpp:41:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    ans=max(ans,st[tree][l++]);
                             ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
salesman.cpp:41:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    ans=max(ans,st[tree][l++]);
                             ^
salesman.cpp:46:29: error: no matching function for call to 'max(int&, ll&)'
    ans=max(ans,st[tree][r--]);
                             ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
salesman.cpp:46:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    ans=max(ans,st[tree][r--]);
                             ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
salesman.cpp:46:29: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    ans=max(ans,st[tree][r--]);
                             ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
salesman.cpp:46:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    ans=max(ans,st[tree][r--]);
                             ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
salesman.cpp:46:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    ans=max(ans,st[tree][r--]);
                             ^
salesman.cpp: In function 'void update(int, int, int)':
salesman.cpp:60:41: error: no matching function for call to 'max(ll&, int&)'
  st[tree][pos]=max(st[tree][pos],new_val);
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
salesman.cpp:60:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  st[tree][pos]=max(st[tree][pos],new_val);
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from salesman.cpp:3:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
salesman.cpp:60:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
  st[tree][pos]=max(st[tree][pos],new_val);
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
salesman.cpp:60:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  st[tree][pos]=max(st[tree][pos],new_val);
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from salesman.cpp:8:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
salesman.cpp:60:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  st[tree][pos]=max(st[tree][pos],new_val);
                                         ^
salesman.cpp: In function 'int main()':
salesman.cpp:84:9: error: 'class std::vector<std::tuple<int, int, int> >' has no member named 'pb'
   fairs.pb({t,l,m});
         ^~