Submission #837187

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

vector<int> ans(12);
vector<int> wut(12);
int p = 0;

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

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

vector<int> ans(12);
vector<int> wut(12);
int p = 0;

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

int decode (int n, int q, int h) {
    p = 0;
    h--;
    dude(0,q,0);
    return ans[h];
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:30:21: warning: control reaches end of non-void function [-Wreturn-type]
   30 |     vector<int> a(12);
      |                     ^
# Verdict Execution time Memory Grader output
1 Execution timed out 7078 ms 2504 KB Time limit exceeded
2 Execution timed out 7085 ms 2420 KB Time limit exceeded