Submission #1269177

#TimeUsernameProblemLanguageResultExecution timeMemory
1269177nerrrminCrayfish scrivener (IOI12_scrivener)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn = 2e6 + 10;
char last;
int n;
char onv[maxn];
int from[maxn], jump[maxn][22], len[maxn];
vector < int > g;
int curr;
void Init()
{
    n = 1;
    onv[1] = '-';
    len[1] = 0;
    curr = 1;
    g.pb(1);
}

void TypeLetter(char L) {

  last = L;
  n ++;

  from[n] = curr;
  onv[n] = L;
  len[n] = len[curr] + 1;
  jump[n][0] = curr;
  for (int j = 1; j < 21; ++ j)
  {
      jump[n][j] = jump[jump[n][j-1]][j-1];
  }
  curr = n;
    g.pb(curr);
}

void UndoCommands(int U)
{
    int sz = g.size()-1;
    curr = g[sz - U];
    g.pb(curr);
}

char GetLetter(int P)
{

    int state = curr;
    int on = state;
    int steps = len[curr] - P - 1;
    if(len[curr] < P+1)return '';
    
    for (int bit = 0; bit < 21; ++ bit)
    {
        if((1 << bit) & steps)curr = jump[curr][bit];
    }
  return onv[curr];

}

Compilation message (stderr)

scrivener.cpp:50:31: error: empty character constant
   50 |     if(len[curr] < P+1)return '';
      |                               ^~