This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include "memory.h"
#include<vector>
using namespace std;
/* -1 -> no ecnontrado pareja
0 -> dulce
>0 -> preguntar*/
void play(){
vector<int>abc(25,-1);
vector<bool>preguntar (25, true);
int i = 1, dulces = 0, encontre = 0, parejas = 2;
while(true){
if(dulces == 25){ //lo logre
return;
}
if(preguntar[i] == true){
if(encontre != 0){
i = encontre;
encontre = 0;
}
char carta = faceup(i); //pido caracter
int valor = carta-'A'; //indice caracter
parejas--; //ya pedi una
if(abc[valor] == -1){ //sin pareja
abc[valor] = i;
}
else if(abc[valor] > 0){ //con pareja
if(parejas == 1){
carta = faceup(abc[valor]); //solicito pareja
parejas--;
dulces++;
}
else if(parejas == 0){
encontre = i;
}
}
preguntar[i] = false;
}
if(parejas == 0){
parejas = 2;
}
i++;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |