Submission #200230

#TimeUsernameProblemLanguageResultExecution timeMemory
200230DavidDamianMemory (IOI10_memory)C++11
100 / 100
8 ms504 KiB
#include "grader.h"
#include "memory.h"

int location[255];
void play()
{
    for(int i=1;i<=50;i++){
        char letter=faceup(i);
        if(location[letter]!=0)
            faceup(location[letter]); //As you had the location of its pair,you face it up too
        else{
            location[letter]=i; //Store the location of that letter
            letter=faceup(i+1); //Face up a new letter
            if(location[letter]!=0) continue; //That letter was already seen
            else{
                location[letter]=i+1;
                i++; //You do not have to face up the card i+1 again
            }
        }
    }
}

Compilation message (stderr)

memory.cpp: In function 'void play()':
memory.cpp:9:27: warning: array subscript has type 'char' [-Wchar-subscripts]
         if(location[letter]!=0)
                           ^
memory.cpp:10:35: warning: array subscript has type 'char' [-Wchar-subscripts]
             faceup(location[letter]); //As you had the location of its pair,you face it up too
                                   ^
memory.cpp:12:28: warning: array subscript has type 'char' [-Wchar-subscripts]
             location[letter]=i; //Store the location of that letter
                            ^
memory.cpp:14:31: warning: array subscript has type 'char' [-Wchar-subscripts]
             if(location[letter]!=0) continue; //That letter was already seen
                               ^
memory.cpp:16:32: warning: array subscript has type 'char' [-Wchar-subscripts]
                 location[letter]=i+1;
                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...