# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
991700 |
2024-06-02T20:04:20 Z |
De3b0o |
Present (RMI21_present) |
C++17 |
|
1612 ms |
524288 KB |
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)
using namespace std;
const ll N = 25;
ll gc[N+1][N+1];
vector<vector<ll>> s;
vector<vector<ll>> ans;
bool cnt[N+1];
void solve(ll idx)
{
if(idx==0)
{
vector<ll> v;
for(int i = 1 ; N>=i ; i++)
if(cnt[i])
v.pb(i);
reverse(v.begin(),v.end());
s.pb(v);
return;
}
solve(idx-1);
if(cnt[idx])
return;
cnt[idx]=1;
vector<ll> vis;
vis.pb(idx);
for(int i = 1 ; N>=i ; i++)
{
if(cnt[i]&&cnt[gc[i][idx]])
{
vis.pb(gc[i][idx]);
cnt[gc[i][idx]]=1;
}
}
solve(idx-1);
for(auto it : vis)
cnt[it]=0;
return;
}
int main()
{
d3
for(int i = 0 ; N>=i ; i++)
for(int j = 0 ; N>=j ; j++)
gc[i][j]=__gcd(i,j);
solve(N);
ll t;
cin >> t;
while(t--)
{
ll k;
cin >> k;
cout << ans[k].size() << " ";
for(int i = ans[k].size()-1 ; i>=0 ; i--)
cout << ans[k][i] << " ";
lin
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1612 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1612 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1612 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1612 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1612 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |