답안 #656549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
656549 2022-11-08T00:37:19 Z definitelynotmee 질문 (CEOI14_question_grader) C++
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
using namespace std;
template <typename T>
using matrix = vector<vector<T>>;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INFL = (1LL<<62)-1;
const int INF = (1<<30)-1;
const double EPS = 1e-7;
const int MOD = 1e9 + 7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
const int MAXN = 1e6+1;

int encode (int n, int x, int y) {
    vector<int> v(n+1);
    int x = (1<<6)-1;
    for(int i = 1; i <= n; i++){
        int id = 0;
        while(__builtin_popcount(x) != 6){
            x|=1<<id;
            id++;
        }
        v[i] = x;
        x++;
    }
    for(int i = 0; i < 12; i++){
        if(bool(v[x]&(1<<i)) && !bool(v[y]&(1<<i)))
            return i+1;
    }

}
#include<bits/stdc++.h>
using namespace std;

int decode (int n, int q, int h) {
    h--;
    vector<int> v(n+1);
    int x = (1<<6)-1;
    for(int i = 1; i <= n; i++){
        int id = 0;
        while(__builtin_popcount(x) != 6){
            x|=1<<id;
            id++;
        }
        v[i] = x;
        x++;
    }


	return bool(v[q]&(1<<h));
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:24:9: error: declaration of 'int x' shadows a parameter
   24 |     int x = (1<<6)-1;
      |         ^
encoder.cpp:22:24: note: 'int x' previously declared here
   22 | int encode (int n, int x, int y) {
      |                    ~~~~^
encoder.cpp:23:22: warning: control reaches end of non-void function [-Wreturn-type]
   23 |     vector<int> v(n+1);
      |                      ^