Submission #260262

#TimeUsernameProblemLanguageResultExecution timeMemory
260262ElyesChaabouniCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
int nb=0;
vector<pair<int, int> >v;
string s;
void Init()
{
	nb=0;
	v.clear();
	s="";
}
void TypeLetter(char L)
{
	nb++;
	v.push_back(make_pair(0, L-'a'));
}
void UndoCommands(int U)
{
	nb++;
	v.push_back(1, U);
}
char GetLetter(int P)
{
	if(nb==0)
		return s[P];
	nb=0;
	int cnt=0, l=0;
	s="";
	for(int i = v.size()-1; i >= 0; i--)
	{
		if(v[i].first)
		{
			if(!cnt)
				s+=(char)('a'+v[i].second);
		}
		else
		{
			if(!cnt)
			{
				cnt=1;
				l=i-v[i].second;
			}
		}
		if(i==l && cnt)
			cnt=0;
	}
	reverse(s.begin(), s.end());
	return s[P];
}

Compilation message (stderr)

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:30:18: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int, int&)'
  v.push_back(1, U);
                  ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from scrivener.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   candidate expects 1 argument, 2 provided