Submission #133770

#TimeUsernameProblemLanguageResultExecution timeMemory
133770claudyCrayfish scrivener (IOI12_scrivener)C++14
26 / 100
206 ms14312 KiB
//# pragma GCC optimize("Ofast,no-stack-protector")
//# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//# pragma GCC optimize("Ofast")
//# pragma GCC optimization ("unroll-loops")
# include "bits/stdc++.h"
/*
# include <ext/pb_ds/tree_policy.hpp>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/rope>
*/
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
//# define int ll
using namespace std;

string s = "";
vector<pair<int,int>>ops;
int k = 0;

void Init()
{
	
}

void TypeLetter(char L)
{
	ops.pb(mp(0,L - 'a'));
}

void UndoCommands(int U)
{
	ops.pb(mp(1,U));
}

char GetLetter(int P)
{
	if(k == 0)
	{
		k = 1;
		int op;
		while(sz(ops))
		{
			if(sz(ops) < op)
			{
				if(ops.back().first == 0) s += (char)('a' + ops.back().second);
				else
				{
					op = sz(ops) - ops.back().second;
				}
			}
			ops.pop_back();
		}
		reverse(s.begin(),s.end());
	}
	return s[P];
}

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:52:4: warning: 'op' may be used uninitialized in this function [-Wmaybe-uninitialized]
    if(sz(ops) < op)
    ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...