Submission #198829

#TimeUsernameProblemLanguageResultExecution timeMemory
198829Markomafko972Memory (IOI10_memory)C++14
0 / 100
6 ms376 KiB
#include "grader.h" #include "memory.h" void play() { int v[50][5]; for (int i = 1; i <= 50; i++) v[i][0] = 0, v[i][1] = 0; for (int i = 1; i <= 50; i+= 2) { char c1 = faceup(i); char c2 = faceup(i+1); if (c1 != c2) { if (v[c1-'A'+1][0] == 0) v[c1-'A'+1][0] = i; else v[c1-'A'+1][1] = i; if (v[c2-'A'+1][0] == 0) v[c2-'A'+1][0] = i+1; else v[c2-'A'+1][1] = i+1; } } for (int i = 1; i <= 50; i++) { if (v[i][1] != 0) { faceup(v[i][0]); faceup(v[i][1]); } } }

Compilation message (stderr)

memory.cpp: In function 'void play()':
memory.cpp:6:40: warning: iteration 49 invokes undefined behavior [-Waggressive-loop-optimizations]
  for (int i = 1; i <= 50; i++) v[i][0] = 0, v[i][1] = 0;
                                ~~~~~~~~^~~
memory.cpp:6:20: note: within this loop
  for (int i = 1; i <= 50; i++) v[i][0] = 0, v[i][1] = 0;
                  ~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...