Submission #198474

#TimeUsernameProblemLanguageResultExecution timeMemory
198474model_codeMemory (IOI10_memory)C++14
100 / 100
8 ms508 KiB
#include "grader.h"
#include "memory.h"

void play() {
  // letters 'A' to 'Y' are converted to integers 0 to 24
  int index[50][2]; // locations of cards; 0 = unknown
  int lt, k; // traverses index
  int i; // traverses cards
  char r; // result of faceup

  // initialize index
  for (lt = 0; lt < 25; ++lt) {
    for (k = 0; k < 2; ++k) {
      index[lt][k] = 0;
    }
  }
  // first round
  for (i = 1; i <= 50; ++i) {
    r = faceup(i);
    lt = (int)(r) - (int)('A'); // int corresponding to char r
    k = (index[lt][0]) ? 1 : 0;
    index[lt][k] = i;
  }
  // second round
  for (lt = 0; lt < 25; ++lt) {
    faceup( index[lt][0] ); // result ignored
    faceup( index[lt][1] ); // result ignored
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...