Submission #119241

# Submission time Handle Problem Language Result Execution time Memory
119241 2019-06-20T17:34:47 Z ioilolcom Crayfish scrivener (IOI12_scrivener) C++14
Compilation error
0 ms 0 KB
string ans="";
void Init() {
	ans="";
}



void Init() {
}
void TypeLetter(char L){
	ans+=L;
}
void UndoCommands(int m) {
	if(m>=(int)ans.size()) {
		ans="";
	}
	else{
		ans.erase((int)ans.size()-m,(int)ans.size()-1);
	}
}
char GetLetter(int P){
	return ans[P-1];
}

Compilation message

scrivener.cpp:2:1: error: 'string' does not name a type; did you mean 'struct'?
 string ans="";
 ^~~~~~
 struct
scrivener.cpp: In function 'void Init()':
scrivener.cpp:4:2: error: 'ans' was not declared in this scope
  ans="";
  ^~~
scrivener.cpp: In function 'void Init()':
scrivener.cpp:9:6: error: redefinition of 'void Init()'
 void Init() {
      ^~~~
scrivener.cpp:3:6: note: 'void Init()' previously defined here
 void Init() {
      ^~~~
scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:12:2: error: 'ans' was not declared in this scope
  ans+=L;
  ^~~
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:15:13: error: 'ans' was not declared in this scope
  if(m>=(int)ans.size()) {
             ^~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:23:9: error: 'ans' was not declared in this scope
  return ans[P-1];
         ^~~