#include <vector>
#include <algorithm>
using namespace std;
vector < int > s;
vector < vector < int > > v;
void rek(int x, int br){
if(br==6){
v.push_back(s);
return;
}
if(x==13){
return;
}
s.push_back(x);
rek(x+1, br+1);
s.pop_back();
rek(x+1, br);
}
void precompute(){
rek(1, 0);
}
int encode (int n, int x, int y) {
precompute();
vector < int > s1, s2;
s1=v[x];
s2=v[y];
v.clear();
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.begin();
}
#include <vector>
#include <algorithm>
using namespace std;
vector < int > s;
vector < vector < int > > v;
void rek(int x, int br){
if(br==6){
v.push_back(s);
return;
}
if(x==13){
return;
}
s.push_back(x);
rek(x+1, br+1);
s.pop_back();
rek(x+1, br);
}
void precompute(){
rek(1, 0);
}
int decode (int n, int q, int h) {
precompute();
vector < int > s1=v[q];
v.clear();
if(find(s1.begin(), s1.end(), h)!=s1.end()){
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
7099 ms |
1776 KB |
Time limit exceeded |
2 |
Execution timed out |
7032 ms |
1832 KB |
Time limit exceeded |