Submission #102999

# Submission time Handle Problem Language Result Execution time Memory
102999 2019-03-28T12:44:04 Z wxh010910 Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
1000 ms 89560 KB
#include <bits/stdc++.h>

using namespace std;

vector<int> from, depth;
vector<vector<int>> anc;
vector<char> type;

void Init() {
  type.push_back(' ');
  depth.push_back(0);
  anc.push_back(vector<int>());
  from.push_back(0);
}

void TypeLetter(char L) {
  type.push_back(L);
  depth.push_back(depth[from.back()] + 1);
  anc.push_back(vector<int>(1, from.back()));
  for (int i = 1; depth.back() >> i; ++i) {
    anc.back().push_back(anc[anc.back()[i - 1]][i - 1]);
  }
  from.push_back(from.size());
}

void UndoCommands(int U) {
  type.push_back(' ');
  depth.push_back(-1);
  anc.push_back(vector<int>());
  from.push_back(from[from.size() - 1 - U]);
}

char GetLetter(int P) {
  int jump = depth[from.back()] - 1 - P;
  int x = from.back();
  for (int i = 0; jump; ++i) {
    if (jump >> i & 1) {
      x = anc[x][i];
    }
  }
  return type[x];
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 89560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 5432 KB Time limit exceeded
2 Halted 0 ms 0 KB -