# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645600 | TimDee | Present (RMI21_present) | C++17 | 1299 ms | 391424 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 <bits/stdc++.h>
using namespace std;
#define forn(i,n) for (int i=0;i<n;++i)
#define prn {cout<<"NO\n";return;}
#define pry cout<<"YES\n";
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
vector<vector<int>> a;
void solve() {
int k; cin>>k;
cout<<a[k].size()<<' ';
for (auto x:a[k]) cout<<x<<' '; cout<<'\n';
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
a={{},{1},{2},{1,2}};
int mx=3;
while (a.size()<=1000000) {
vector<vector<int>> b;
for (auto x:a) {
vector<int> y;
int scuza=1;
for (auto v:x) {
int k=__gcd(v,mx);
//cout<<v<<' '<<mx<<' '<<k<<' ';
int paiu=0;
for (auto u:x) paiu|=u==k;
scuza&=paiu;
//cout<<paiu<<" ";
}
y=x;
y.push_back(mx);
if (scuza) b.push_back(y);
}
for (auto x:b) a.push_back(x);
++mx;
}
int t; cin>>t;
while (t--) solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |