結果
問題 | No.3028 No.9999 |
ユーザー |
![]() |
提出日時 | 2025-02-22 18:19:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,156 bytes |
コンパイル時間 | 5,712 ms |
コンパイル使用メモリ | 162,756 KB |
実行使用メモリ | 13,764 KB |
最終ジャッジ日時 | 2025-02-22 18:19:57 |
合計ジャッジ時間 | 12,713 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 TLE * 1 -- * 1 |
other | -- * 23 |
ソースコード
#ifndef ONLINE_JUDGE//なんか手元ではデバックモードになって、atcoder上ではデバックモードにならないらしい ABC325Dはこれで通った#define _GLIBCXX_DEBUG//[]で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意 ABC311Eのサンプル4のデバックTLEなどに注意#endif//これと上のONLINE JUDGEが絶対必要//★TLEにならないはずなのにTLEになったらオンラインジャッジを消してデバックモードのまま提出をする。#include <bits/stdc++.h>using namespace std;using ll=long long;using ull=unsigned long long;using ld = long double;using Pii=pair<int,int>;using Pll=pair<ll,ll>;using TT=tuple<int,int,int>;#define mPP(a,b) make_pair(a,b)#define mTT(a,b,c) make_tuple(a,b,c)#define rep1(a) for(int i = 0; i < (int)(a); i++)#define rep2(i, a) for(int i = 0; i < (int)(a); i++)#define rep3(i, a, b) for(int i = (int)(a); i < (int)(b); i++)#define rep4(i, a, b, c) for(int i = (int)(a); i < (int)(b); i += c)#define overload4(a, b, c, d, e, ...) e#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)#define rrep(i,n) for(ll i = (ll)(n); i >= 0; --i)#define RREP(i,advanced,n) for(int i = (int)(n)-1; i >= advanced; --i)#define all(vec) vec.begin(),vec.end()#define rall(vec) vec.rbegin(),vec.rend()#define ALL(a,middle,last) a.begin()+middle,a.begin()+last#define w_np(a) while(next_permutation(a))#define chmax(x,y) x = max(x,y)#define chmin(x,y) x = min(x,y)#define mycin(vec) for(auto &v:vec) cin >> v;#define mycout(vec) for(auto &v:vec) cout << v << " ";#define dame cout<<-1<<endl#define YES cout<<"Yes"<<endl#define YEAH { cout << "Yes" << endl; return 0; }#define NO cout<<"No"<<endl#define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} // if(ans[i])YN;#define UQ(v) v.erase( unique(all(v)), v.end() );#define MHT(x1,x2,y1,y2) (abs(x1-x2)+abs(y1-y2)) // マンハッタン距離 = |x1-x2|+|y1-y2| 座標の絶対値の和#define YKD(x1,x2,y1,y2) ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) // ユークリッド距離 座標の差の二乗の和// #define YKD(x1,x2,y1,y2) (pow(x1-x2,2) + pow(y1-y2,2)) // でっかい数のとき 数が 1e10 みたいに表記される場合に注意#define displace(vec) rotate(vec.begin(),vec.begin()+1,vec.end()) // abcd -> bcda のように一つ要素をずらす#define DISPLACE(vec,First,Middle,Last) rotate(vec.begin()+First,vec.begin()+Middle,vec.begin()+Last)// ……a[F-1] (( a[F] a[F+1] …… a[M-1] a[M] a[M+1] …… a[L-1] )) a[L]…… -> ……a[F-1] (( a[M] a[M+1] …… a[L-1] …… a[F] a[F+1] …… a[M-1] )) a[L]……template<typename T> using vc = vector<T>;template<class T> using PQ = priority_queue<T, vc<T>>; // 大きい順に取り出すtemplate<class T> using PQ_G = priority_queue<T, vc<T>, greater<T>>; // 小さい順に取り出すll pow2(ll x) { return x * x; };ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }vc<ll> dx = { 1,0,-1,0 };vc<ll> dy = { 0,1,0,-1 };// vc<ll> dx={1,1,0,-1,-1,-1,0,1};// vc<ll> dy={0,1,1,1,0,-1,-1,-1};int INF = 2e9;// ll INF = 2e18;ll c(ll n, ll m){// cout << "c:" << n << ',' << m << "->" << flush;ll sum = 1, ss = 1;rep(i,2,n+1) {sum *= i;if(i <= m) {if(sum % i == 0) sum /= i;else ss *= i;}else {if(sum % (i-m) == 0) sum /= (i - m);else ss *= (i - m);}}// cout << sum << endl;return (ll)(sum / ss);}ll search(ll n, ll i){ll l = i, r = n+i+1;while(r-l > 1){ll mid = (r+l) / 2;if(c(mid,i) <= n) l = mid;else r = mid;}// cout << "A" << endl;return l;}int main(){ll n,I; cin >> n >> I;rrep(i,I){// cout << "B" << endl;ll s = search(n,i);cout << s << " ";n -= c(s,i);if(n == 0) break;}cout << endl;return 0;}