Submission #1221871

#TimeUsernameProblemLanguageResultExecution timeMemory
1221871vladiliusQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
0 / 100
482 ms41180 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second

int encode(int n, int x, int y){
    if (x > y){
        for (int i = 10; i >= 1; i--){
            int j = i - 1;
            bool x1 = (x >> j) & 1, y1 = (y >> j) & 1;
            if (x1 != y1){
                return i;
            }
        }
    }
    else {
        for (int i = 10; i >= 1; i--){
            int j = i - 1;
            bool x1 = (x >> j) & 1, y1 = (y >> j) & 1;
            if (x1 != y1){
                return (i + 10);
            }
        }
    }
    return 0;
}

int decode(int n, int q, int h){
    return (h <= 10) ? (q >> (h - 1)) & 1 : !(q >> (h - 11));
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second

int encode(int n, int x, int y){
    if (x > y){
        for (int i = 10; i >= 1; i--){
            int j = i - 1;
            bool x1 = (x >> j) & 1, y1 = (y >> j) & 1;
            if (x1 != y1){
                return i;
            }
        }
    }
    else {
        for (int i = 10; i >= 1; i--){
            int j = i - 1;
            bool x1 = (x >> j) & 1, y1 = (y >> j) & 1;
            if (x1 != y1){
                return (i + 10);
            }
        }
    }
    return 0;
}

int decode(int n, int q, int h){
    return (h <= 10) ? (q >> (h - 1)) & 1 : !(q >> (h - 11));
}
#Verdict Execution timeMemoryGrader output
Fetching results...