Submission #645585

#TimeUsernameProblemLanguageResultExecution timeMemory
645585TimDeePresent (RMI21_present)C++17
29 / 100
1179 ms391360 KiB
#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)

Main.cpp: In function 'void solve()':
Main.cpp:17:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   17 |  for (auto x:a[k]) cout<<x<<' '; cout<<'\n';
      |  ^~~
Main.cpp:17:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   17 |  for (auto x:a[k]) cout<<x<<' '; cout<<'\n';
      |                                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...