Submission #1221876

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