#pragma GCC optimize("O3")
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#define endl '\n'
#include <unordered_map>
using namespace std;
typedef int ll;
ll used[10001];
ll step = 0;
vector<int>vec;
bool check(vector<ll>a){
step++;
vec.clear();
vec.resize(31, 0);
for(auto i: a)
vec[i]++;
for(int num = 1; num <= 30; num++){
if(vec[num])
continue;
ll cnt = 0;
for(int j = 1; j * num < 30; j++){
cnt += vec[j * num];
}
if(cnt >= 2)
return false;
}
return true;
}
int main(){
vector<vector<ll>>d(1000009);
int pos = 1;
for(int num = 1; num <= 1000; num++){
d[pos++] = {num};
ll last = pos - 1;
for(int j = 1; j < last; j++){
d[pos] = d[j];
d[pos].push_back(num);
if(!check(d[pos]))
continue;
pos++;
if(pos >= 1000001)
break;
}
if(pos >= 1000001)
break;
}
ll t;
cin >> t;
while(t--){
ll n;
cin >> n;
cout << d[n].size() << ' ';
for(auto i: d[n])
cout << i << ' ';
cout << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
125612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
125612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
125612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
125612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
344 ms |
125612 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |