Submission #837185

# Submission time Handle Problem Language Result Execution time Memory
837185 2023-08-25T07:20:17 Z Andrey Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 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;

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);
      |                     ^

decoder.cpp: In function 'void dude(int, int, int)':
decoder.cpp:6:9: error: 'p' was not declared in this scope
    6 |         p++;
      |         ^
decoder.cpp:9:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |                 ans[i] = wut[i];
      |                 ^~~
      |                 abs
decoder.cpp:9:26: error: 'wut' was not declared in this scope
    9 |                 ans[i] = wut[i];
      |                          ^~~
decoder.cpp:18:5: error: 'wut' was not declared in this scope
   18 |     wut[d] = 1;
      |     ^~~
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:24:5: error: 'p' was not declared in this scope
   24 |     p = 0;
      |     ^
decoder.cpp:27:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |     return ans[h];
      |            ^~~
      |            abs