# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
564822 | almothana05 | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 3022 ms | 24180 KiB |
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 <stdio.h>
#include <stdlib.h>
#include<bits/stdc++.h>
using namespace std;
string bi(int x){
string cmp;
while(x){
if(x % 2 == 0){
cmp +='0';
}
else{
cmp += '1';
}
x /= 2;
}
while(cmp.size() < 10){
cmp += '0';
}
return cmp;
}
int encode (int n, int x, int y) {
int re1 = 0 , re2 = 0;
string s , t;
s = bi(x);
t = bi(y);
for(int i = 0 ; i < s.size() ; i++){
if(s[i] == '1' && t[i] == '0'){
return i + 1;
}
re1 += s[i] - '0';
re2 += t[i] - '0';
}
s = bi(re1);
t = bi(re2);
for(int i = 0 ; i < t.size() ; i++){
if(s[i] == '0' && t[i] == '1'){
return 10 + i + 1;
}
}
assert(5 == 6);
}
#include <stdio.h>
#include <stdlib.h>
#include<bits/stdc++.h>
using namespace std;
string bi(int x){
string cmp;
while(x){
if(x % 2 == 0){
cmp +='0';
}
else{
cmp += '1';
}
x /= 2;
}
while(cmp.size() < 10){
cmp += '0';
}
return cmp;
}
int decode (int n, int q, int h) {
int re = 0;
string s = bi(q);
if(h <= 10){
if(s[h - 1] == '1'){
return 1;
}
else{
return 0;
}
}
h -= 11;
for(int i = 0 ; i <s.size() ; i++){
if(s[i] == '1'){
re++;
}
}
s = bi(re);
if(s[h] == '0'){
return 1;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |