Submission #260556

# Submission time Handle Problem Language Result Execution time Memory
260556 2020-08-10T14:12:46 Z ElyesChaabouni Crayfish scrivener (IOI12_scrivener) C++14
0 / 100
496 ms 262148 KB
/*#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 pos=0;
vector<int>v, depth;
vector<char>tree;
vector<int>son[10005], anc[10005];
void process(int x, int y)
{
	int nb=0;
	bool ok=true;
	anc[x].push_back(y);
	while(ok)
	{
		int cu=anc[x].back();
		if(anc[cu].size() > nb)
		{
			anc[x].push_back(anc[cu][nb]);
			nb++;
		}
		else
			ok=false;
	}
}
char find_kth(int x, int k)
{
	int nb=0;
	while(k)
	{
		if(k%2==0)
			x=anc[x][nb];
		nb++;
		k/=2;
	}
	return tree[x];
}
void Init()
{
	v.clear();
	tree.clear();
	tree.push_back(0);
	depth.push_back(0);
	pos=1;
}
void TypeLetter(char L)
{
	tree.push_back(L);
	son[pos].push_back(tree.size()-1);
	process(tree.size()-1, pos);
	depth.push_back(depth[pos]+1);
	pos=tree.size()-1;
	v.push_back(pos);
}
void UndoCommands(int U)
{
	v.push_back(0);
	v.back()=v[v.size()-U];
	pos=v.back();
	depth.push_back(depth[pos]);
}
char GetLetter(int P)
{
	P++;
	return find_kth(pos, depth[pos]-P);
}
//size

Compilation message

scrivener.cpp: In function 'void process(int, int)':
scrivener.cpp:25:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(anc[cu].size() > nb)
      ~~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 496 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 477 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 475 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 467 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 477 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -