제출 #784789

#제출 시각아이디문제언어결과실행 시간메모리
784789jakobrsMemory (IOI10_memory)C++17
100 / 100
2 ms280 KiB
#include <vector>

#include "grader.h"
#include "memory.h"

void play() {
  std::vector<int> index_of(50, -1);

  int next = 1;
  for (int correct = 0; correct < 25;) {
    int first = faceup(next) - 'A';
    if (index_of[first] != -1) {
      faceup(index_of[first]);
      correct += 1;
      next += 1;
    } else {
      index_of[first] = next;
      next += 1;
      int second = faceup(next) - 'A';
      if (second == first) {
        correct += 1;
        next += 1;
      } else if (index_of[second] != -1) {
        faceup(next);
        faceup(index_of[second]);
        correct += 1;
        next += 1;
      } else {
        index_of[second] = next;
        next += 1;
      }
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...