Submission #118559

# Submission time Handle Problem Language Result Execution time Memory
118559 2019-06-19T08:17:06 Z roseanne_pcy Crayfish scrivener (IOI12_scrivener) C++14
Compilation error
0 ms 0 KB
//Power Of Ninja Go
#include <bits/stdc++.h>
#ifdef atom
    #include "grader.cpp"
#endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii;
#define X first
#define Y second
#define vi vector<int>
#define vii vector< ii >
#define pb push_back
const int maxn = 1e6+5;
int dp[25][maxn];
char txt[maxn];
int sz[maxn];
int ver[maxn];
int rounds = 1;
int n = 1;
void Init()
{
    return;
}y

int kth(int u, int k)
{
    for(int i = 22; i>= 0; i--)
    {
        if((1<<i)<= k)
        {
            u = dp[i][u];
            k -= 1<<i;
        }
    }
    return u;
}
void TypeLetter(char L)
{
    int lver = ver[rounds-1];
    dp[0][n] = lver;
    for(int i = 1; i<= 22; i++) dp[i][n] = dp[i-1][dp[i-1][n]];
    sz[n] = 1+sz[lver];
    //printf("sz[%d] = %d\n", n, sz[n]);
    //printf("ver[%d] = %d\n", rounds, n);
    txt[n] = L;
    ver[rounds] = n;
    rounds++; n++;
}

void UndoCommands(int U)
{
    int want = ver[rounds-U-1];
    ver[rounds] = want;
    rounds++;
}

char GetLetter(int P)
{
    P = sz[ver[rounds-1]]-P-1;
    //printf("P is %d\n", P);
    int tmp = kth(ver[rounds-1], P);
    return txt[tmp];
}

Compilation message

scrivener.cpp:23:2: error: 'y' does not name a type
 }y
  ^
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:61:15: error: 'kth' was not declared in this scope
     int tmp = kth(ver[rounds-1], P);
               ^~~