Submission #943305

# Submission time Handle Problem Language Result Execution time Memory
943305 2024-03-11T10:26:11 Z oblantis Crayfish scrivener (IOI12_scrivener) C++17
Compilation error
0 ms 0 KB
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int inf = 1e9;
const int mod = 1e9+7;
const int maxn = 1e6 + 1;

char last;
int cnt, ope[maxn][20], wt[maxn], sz[maxn];

void Init() {
	wt[0] = -1;
	for(int j = 0; j < 20; j++)ope[0][j] = 0;
	cnt = 1;
}

void TypeLetter(char L) {
	sz[cnt] = sz[cnt - 1] + 1;
	wt[cnt] = int(L - 'a');
	ope[cnt][0] = cnt;
	ope[cnt][1] = ope[cnt - 1][0];
	for(int j = 2; j < 20; j++){
		ope[cnt][j] = ope[ope[cnt][j - 1]][j - 1];
	}
	cnt++;
}

void UndoCommands(int U) {
	U++;
	for(int j = 0; j < 20; j++)ope[cnt][j] = ope[cnt - U][j];
	wt[cnt] = -2;
	sz[cnt] = sz[cnt - U];
	cnt++;
}

char GetLetter(int P) {
	int x = ope[cnt - 1][0];
	P = sz[x] - P - 1;
	for(int j = 18; j >= 0; j--){
		if(P & (1 << j))x = ope[x][j + 1];
	}
	return char('a' + wt[x]);
//}
//#define inbuf_len 1 << 16
//#define outbuf_len 1 << 16

//void solve() {
  //Init();

  //int cmd_num;
  //int tmp = scanf("%d", &cmd_num);

  //int i;
  //for (i = 0; i < cmd_num; i++) {
    //char cmd;
    //tmp = scanf(" %c", &cmd);
    //if (cmd == 'T') {
      //char letter;
      //tmp = scanf(" %c", &letter);
      //assert(tmp == 1);
      //TypeLetter(letter);
    //}
    //else if (cmd == 'U') {
      //int number;
      //tmp = scanf("%d", &number);
      //assert(tmp == 1);
      //UndoCommands(number);
    //}
    //else if (cmd == 'P') {
      //int index;
      //char letter;
      //tmp = scanf("%d", &index);
      //assert(tmp == 1);
      //letter = GetLetter(index);
      //printf("%c\n", letter);
    //}
  //}
  
  //puts("Let's test for cheating!!");

//}

//int main() {
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//int times = 1;
	////cin >> times;
	//for(int i = 1; i <= times; i++) {
		//solve();
	//}
	//return 0;
//}

Compilation message

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:50:26: error: expected '}' at end of input
   50 |  return char('a' + wt[x]);
      |                          ^
scrivener.cpp:44:23: note: to match this '{'
   44 | char GetLetter(int P) {
      |                       ^