제출 #471661

#제출 시각아이디문제언어결과실행 시간메모리
471661TheScrasse질문 (CEOI14_question_grader)C++14
100 / 100
4537 ms24176 KiB
#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 110

vector<ll> v;

int encode(int n, int x, int y) {
    ll i, mk;

    if (v.empty()) {
        v.pb(0);
        for (mk = 0; mk < (1 << 12); mk++) {
            if (__builtin_popcount(mk) != 6) continue;
            v.pb(mk);
        }
    }

    for (i = 0; i < 12; i++) {
        if (((v[x] >> i) & 1) == 0) continue;
        if (((v[y] >> i) & 1) == 1) continue;
        return i + 1;
    }
}
#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 110

vector<ll> w;

int decode(int n, int q, int h) {
    ll i, mk;

    if (w.empty()) {
        w.pb(0);
        for (mk = 0; mk < (1 << 12); mk++) {
            if (__builtin_popcount(mk) != 6) continue;
            w.pb(mk);
        }
    }

	return ((w[q] >> (h - 1)) & 1);
}

컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:17:8: warning: unused variable 'i' [-Wunused-variable]
   17 |     ll i, mk;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...