提出 #75912172


ソースコード 拡げる

#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define VI vector<int>
#define VII vector<pii>
#define VL vector<ll>
#define VLL vector<pll>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)

#define LOCAL false

using namespace std;
bool st;
const bool MUL=true;

void clr(){
	return;
}
void solve(){
	int n;cin>>n;
	if(n==1){cout<<"Yes\n1\n";return;}
	if(n==2||n==3||n==5){cout<<"No\n";return;}
	cout<<"Yes\n";
	priority_queue<int,VI,greater<int>>q;
	if(n%3==1)rep(i,1,4)q.push(2);
	else if(n%3==0){rep(i,1,3)q.push(2);rep(i,1,2)q.push(3);q.push(6);}
	else{rep(i,1,3)q.push(2);rep(i,1,2)q.push(3);rep(i,1,2)q.push(9);q.push(18);}
	int k=(n-q.size())/3;
	rep(i,1,k){int x=q.top();q.pop();rep(j,1,4)q.push(x<<1);}
	bool f=0;while(q.size()){if(f)cout<<" ";cout<<q.top();q.pop();f=1;}
	cout<<"\n";return; 
}

bool ed;
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int tc=1;if(MUL){cin>>tc;}while(tc--)clr(),solve();
	cerr<<"time:"<<clock()<<"ms.\n";
	cerr<<fixed<<setprecision(4)<<"memory:"<<(1.0*(&st-&ed)/1048576.0)<<"MB.\n";
	return 0;
}

提出情報

提出日時
問題 A - Sum of Reciprocals of Squares
ユーザ Fourier_WJY
言語 C++23 (GCC 15.2.0)
得点 600
コード長 1233 Byte
結果 AC
実行時間 8 ms
メモリ 3940 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 1
AC × 24
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3564 KiB
01_random_00.txt AC 6 ms 3640 KiB
01_random_01.txt AC 6 ms 3564 KiB
01_random_02.txt AC 5 ms 3568 KiB
01_random_03.txt AC 8 ms 3816 KiB
01_random_04.txt AC 8 ms 3932 KiB
01_random_05.txt AC 8 ms 3892 KiB
01_random_06.txt AC 8 ms 3924 KiB
01_random_07.txt AC 8 ms 3892 KiB
01_random_08.txt AC 8 ms 3860 KiB
01_random_09.txt AC 8 ms 3812 KiB
01_random_10.txt AC 8 ms 3896 KiB
01_random_11.txt AC 8 ms 3740 KiB
01_random_12.txt AC 8 ms 3748 KiB
01_random_13.txt AC 8 ms 3936 KiB
01_random_14.txt AC 8 ms 3808 KiB
01_random_15.txt AC 8 ms 3888 KiB
01_random_16.txt AC 8 ms 3892 KiB
01_random_17.txt AC 8 ms 3940 KiB
01_random_18.txt AC 8 ms 3788 KiB
01_random_19.txt AC 8 ms 3940 KiB
01_random_20.txt AC 8 ms 3932 KiB
01_random_21.txt AC 8 ms 3892 KiB
01_random_22.txt AC 8 ms 3920 KiB