結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー rickyorangerickyorange
提出日時 2021-07-30 20:59:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 1,728 ms
コンパイル使用メモリ 172,316 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 03:15:09
合計ジャッジ時間 2,415 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a); i<(n); i++)
#define rrep(i,a,n) for(int i=(a); i>=(n); i--)
#define all(n) begin(n),end(n)
#define rall(n) rbegin(n),rend(n)
//#define yn(bool) if(bool){cout<<Yes<<endl;}else{cout<<No<<endl;}
#define fore(i,a) for(auto &i:a)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}
template <typename T> inline bool chmin(T& a, const T& b) {bool compare = a > b; if (a > b) a = b; return compare;}
template <typename T> inline bool chmax(T& a, const T& b) {bool compare = a < b; if (a < b) a = b; return compare;}
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

void _main() {
	int n;
	cin>>n;
	vi a(9);
	rep(i,0,9) cin>>a[i];
	vi b;
	rep(i,0,9) {
		int an = a[i];
		rep(j,0,an) b.push_back(i+1);
	}
	sort(rall(b));
	string ans;
	rep(i,0,n) ans+=to_string(b[i]);
	cout<<ans<<endl;
}
0