#include <set>
#include <vector>
using namespace std;
set < int > s;
vector < set < int > > v;
void rek(int x, int br){
if(br==6){
v.push_back(s);
return;
}
if(x==13){
return;
}
s.insert(x);
rek(x+1, br+1);
s.erase(x);
rek(x+1, br);
}
void precompute(){
rek(1, 0);
}
int encode (int n, int x, int y) {
precompute();
set < int > s1, s2;
s1=v[x];
s2=v[y];
while(!s2.empty()){
s1.erase(*s2.begin());
s2.erase(s2.begin());
}
v.clear();
return *s1.begin();
}
#include <set>
#include <vector>
using namespace std;
set < int > s;
vector < set < int > > v;
void rek(int x, int br){
if(br==6){
v.push_back(s);
return;
}
if(x==13){
return;
}
s.insert(x);
rek(x+1, br+1);
s.erase(x);
rek(x+1, br);
}
void precompute(){
rek(1, 0);
}
int decode (int n, int q, int h) {
precompute();
set < int > s1=v[q];
v.clear();
if(s1.find(h)!=s1.end()){
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
7065 ms |
748 KB |
Time limit exceeded |
2 |
Execution timed out |
7080 ms |
784 KB |
Time limit exceeded |