//# 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
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)
^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
133 ms |
11208 KB |
Output is correct |
2 |
Correct |
149 ms |
12080 KB |
Output is correct |
3 |
Correct |
155 ms |
12296 KB |
Output is correct |
4 |
Correct |
193 ms |
13900 KB |
Output is correct |
5 |
Correct |
179 ms |
12244 KB |
Output is correct |
6 |
Correct |
161 ms |
13124 KB |
Output is correct |
7 |
Correct |
206 ms |
13652 KB |
Output is correct |
8 |
Correct |
188 ms |
14312 KB |
Output is correct |
9 |
Correct |
162 ms |
12728 KB |
Output is correct |
10 |
Correct |
154 ms |
12360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
3944 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |