Submission #173761

#TimeUsernameProblemLanguageResultExecution timeMemory
173761dennisstarQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++11
100 / 100
1592 ms125192 KiB
#include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; vim a1; int f1(int a) { int ret=0; while (a) {ret+=a&1; a>>=1;} return ret; } void init1() { for (int i=0; i<(1<<12); i++) if (f1(i)==6) a1.push_back(i); } int encode (int n, int x, int y) { if (!a1.size()) init1(); x=a1[x], y=a1[y]; for (int i=0; i<12; i++) if ((x&(1<<i))&&!(y&(1<<i))) return i+1; }
#include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; vim a2; int f2(int a) { int ret=0; while (a) {ret+=a&1; a>>=1;} return ret; } void init2() { for (int i=0; i<(1<<12); i++) if (f2(i)==6) a2.push_back(i); } int decode (int n, int q, int h) { if (!a2.size()) init2(); q=a2[q]; return ((1<<(h-1))&q)?1:0; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...