# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448664 | vanic | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 3655 ms | 24064 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
#include <algorithm>
using namespace std;
int fact[13];
void precompute(){
fact[0]=1;
for(int i=1; i<13; i++){
fact[i]=fact[i-1]*i;
}
}
int povrh(int a, int b){
return fact[a]/(fact[b]*fact[a-b]);
}
vector < int > radi(int x){
vector < int > v;
int ost=6;
for(int i=1; i<=12; i++){
if(!ost){
break;
}
if(x>=povrh(12-i, ost-1)){
x-=povrh(12-i, ost-1);
}
else{
v.push_back(i);
ost--;
}
}
return v;
}
int encode (int n, int x, int y) {
precompute();
vector < int > s1, s2;
s1=radi(x);
s2=radi(y);
while(!s2.empty()){
if(find(s1.begin(), s1.end(), s2.back())!=s1.end()){
s1.erase(find(s1.begin(), s1.end(), s2.back()));
}
s2.pop_back();
}
return s1.back();
}
#include <vector>
#include <algorithm>
using namespace std;
int fact[13];
void precompute(){
fact[0]=1;
for(int i=1; i<13; i++){
fact[i]=fact[i-1]*i;
}
}
int povrh(int a, int b){
return fact[a]/(fact[b]*fact[a-b]);
}
vector < int > radi(int x){
vector < int > v;
int ost=6;
for(int i=1; i<=12; i++){
if(!ost){
break;
}
if(x>=povrh(12-i, ost-1)){
x-=povrh(12-i, ost-1);
}
else{
v.push_back(i);
ost--;
}
}
return v;
}
int decode (int n, int q, int h) {
precompute();
vector < int > s1=radi(q);
if(find(s1.begin(), s1.end(), h)!=s1.end()){
return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |