Submission #26691

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
266912017-07-05 02:56:03sgc109Question (Grader is different from the original contest) (CEOI14_question_grader)C++11
60 / 100
1791 ms25672 KiB
int encode (int n, int x, int y) {
int ok = 0;
int pos = -1;
int sum1 = 0, sum2 = 0;
for(int i = 0 ; i < 10; i++){
int a = (x & (1<<i)) != 0;
int b = (y & (1<<i)) != 0;
sum1 += a;
sum2 += b;
if(a > b){
ok = 1;
pos = i;
break;
}
}
if(pos != -1) return pos+1;
for(int i = 0 ; i < 4; i++){
int a = (sum1 & (1<<i)) != 0;
int b = (sum2 & (1<<i)) != 0;
if(a < b) {
pos = i;
break;
}
}
return 10 + pos + 1;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:2:9: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
     int ok = 0;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...