Submission #1221875

#TimeUsernameProblemLanguageResultExecution timeMemory
1221875vladiliusQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
27 / 100
707 ms41164 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){
    if (h <= 10){
        if ((q >> (h - 1)) & 1){
            return 1;
        }
        return 0;
    }
    else {
        h -= 10;
        if ((q >> (h - 1)) & 1){
            return 0;
        }
        return 1;
    }
}
#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){
    if (h <= 10){
        if ((q >> (h - 1)) & 1){
            return 1;
        }
        return 0;
    }
    else {
        h -= 10;
        if ((q >> (h - 1)) & 1){
            return 0;
        }
        return 1;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...