Submission #347043

#TimeUsernameProblemLanguageResultExecution timeMemory
347043ACmachineQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
0 / 100
2310 ms24284 KiB
int encode (int n, int x, int y) {
    int res;
    if(x > y){
        for(int j = 0; j < 12; ++j){
            if((x & (1 << j))&&!(y & (1 << j))){
                res = j;
                break;
            }
        }
    }
    else{
        for(int j = 0; j < 12; ++j){
            if(!(x & (1 << j)) && (y & (1 << j))){
                res = j;
                break;
            }
        }
    }
    return res + 1;
}
int decode (int n, int q, int h) {
    return (q & (1 << (h-1)));
}

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:19:18: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     return res + 1;
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...