Submission #119831

# Submission time Handle Problem Language Result Execution time Memory
119831 2019-06-22T13:13:39 Z dolphingarlic Crayfish scrivener (IOI12_scrivener) C++14
0 / 100
87 ms 6520 KB
#include <bits/stdc++.h>
using namespace std;

pair<char, char> v[1000001];
char s[1000001];
int indx = 0, i = 0;
bool got = false;

void Init() {
}

void TypeLetter(char L) {
  v[indx++] = {'T', L};
}

void UndoCommands(int U) {
  v[indx++] = {'U', (char)U};
}

char GetLetter(int P) {
  if (!got) {
    int ptr = indx - 1;
    while (ptr != -1) {
      while (ptr != -1 && v[ptr].first == 'U') ptr -= v[ptr].second + 1;
      s[i++] = v[ptr--].second;
    }
    got = true;
  }
  return s[i - 1 - P];
}

// int main() {
//   int t;
//   cin >> t;
//   for (int i = 0; i < t; i++) {
//     char c, d; int e;
//     cin >> c;
//     switch (c) {
//       case 'T':
//         cin >> d;
//         TypeLetter(d);
//         break;
//       case 'P':
        
//         cin >> e;
//         cout << GetLetter(e) << '\n';
//         break;
//       default:
//         cin >> e;
//         UndoCommands(e);
//     }
//   }
// }
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 87 ms 6520 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 2424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -