Submission #958567

# Submission time Handle Problem Language Result Execution time Memory
958567 2024-04-06T04:29:57 Z PoPularPlusPlus Crayfish scrivener (IOI12_scrivener) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define vf first 
#define vs second

const int N = 1000005;
const int L = 25;
vector<char> v[N];
vector<pair<int,int>> val;
vector<vector<pair<int,int>>> up[N];

void Init(){
	val.pb(mp(-1,0));
}

void TypeLetter(char c){
	int pos = val.back().vf + 1;
	pair<int,int> cur = val.back();
	v[pos].pb(c);
	val.pb(mp(pos , v[pos].size()-1));
	vector<pair<int,int>> x;
	x.pb(cur);
	for(int i = 1; i < L; i++){
		if(cur.vf == -1){
			x.pb(mp(-1,0));
		}
		else {
			x.pb(up[cur.vf][cur.vs][i-1]);
			cur = up[cur.vf][cur.vs][i-1];
		}
	}
	up[pos].pb(x);
}

void UndoCommands(int u){
	val.pb(val[val.size()-u-1]);
}

char GetLetter(int p){
	exit();
	pair<int,int> cur = val.back();
	for(int i = L-1; i > 0; i--){
		if(up[cur.vf][cur.vs][i-1].vf > p){
			cur = up[cur.vf][cur.vs][i-1];
		}
	}
	if(p!=cur.vf)cur = up[cur.vf][cur.vs][0];
	//cout << cur.vf << ' ' << cur.vs << endl;
	return v[cur.vf][cur.vs];
}
/*
int main() {
  Init();

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

  int i;
  for (i = 0; i < cmd_num; i++) {
    char cmd;
    tmp = scanf(" %c", &cmd);
    assert(tmp == 1);
    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!!");

  return 0;

}
*/

Compilation message

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:42:7: error: too few arguments to function 'void exit(int)'
   42 |  exit();
      |       ^
In file included from /usr/include/c++/10/bits/std_abs.h:38,
                 from /usr/include/c++/10/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from scrivener.cpp:1:
/usr/include/stdlib.h:617:13: note: declared here
  617 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~