Submission #412746

#TimeUsernameProblemLanguageResultExecution timeMemory
412746A_DCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB

#include <bits/stdc++.h>

using namespace std;
const int N=5e3+100;
int cnt=1;
string s;
string tr;
vector<int> vec;
void Init() {}

void TypeLetter(char L){
    tr+=L;
}
void UndoCommands(int U){
    tr+='U';
    vec.push_back(U);
}
char GetLetter(int P){
    if(cnt){
        cnt=0;
        while(tr.empty()==0){
            char u=tr.back();
            tr.pop_back();
            if(u=='U'){
                int x=vec.back();
                vec.pop_back();
                while(x--){
                    tr.pop_back();
                }
            }
            else{
                s+=u;
            }
        }
        reverse(s.begin(),s.end());
    }
    cout<<s[p];
}

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:38:13: error: 'p' was not declared in this scope
   38 |     cout<<s[p];
      |             ^
scrivener.cpp:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      | ^