Submission #837192

# Submission time Handle Problem Language Result Execution time Memory
837192 2023-08-25T07:40:41 Z Andrey Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
100 / 100
2482 ms 24292 KB
#include<bits/stdc++.h>
using namespace std;

int yoo[950][12];
int p = 0;
vector<int> wut(12);

void dfs(int d, int br) {
    if(d == 12 && br == 6) {
        p++;
        for(int i = 0; i < 12; i++) {
            yoo[p][i] = wut[i];
        }
        return;
    }
    else if(d == 12) {
        return;
    }
    dfs(d+1,br);
    wut[d] = 1;
    dfs(d+1,br+1);
    wut[d] = 0;
}

int encode (int n, int x, int y) {
    if(p == 0) {
        dfs(0,0);
    }
    for(int i = 0; i < 12; i++) {
        if(yoo[x][i] == 1 && yoo[y][i] == 0) {
            return i+1;
        }
    }
}
#include<bits/stdc++.h>
using namespace std;

int yoo[950][12];
int p = 0;
vector<int> wut(12);

void dfs(int d, int br) {
    if(d == 12 && br == 6) {
        p++;
        for(int i = 0; i < 12; i++) {
            yoo[p][i] = wut[i];
        }
        return;
    }
    else if(d == 12) {
        return;
    }
    dfs(d+1,br);
    wut[d] = 1;
    dfs(d+1,br+1);
    wut[d] = 0;
}

int decode (int n, int q, int h) {
    if(p == 0) {
        dfs(0,0);
    }
    return yoo[q][h-1];
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 2385 ms 24244 KB Output is correct - maxh = 12
2 Correct 2482 ms 24292 KB Output is correct - maxh = 12