結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー rickyorangerickyorange
提出日時 2021-07-30 21:17:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 1,694 ms
コンパイル使用メモリ 172,956 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-14 02:58:18
合計ジャッジ時間 4,858 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
権限があれば一括ダウンロードができます

ソースコード

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];
	vector<char> b;
	rep(i,0,9) {
		int an = a[i];
		rep(j,0,an) b.push_back(i+1+'0');
	}
	sort(all(b));
	ll ans=0;
	do{
		string k;
		rep(i,0,n) {
			k+=b[i];
		}
		cout<<k<<endl;
		ans+=stoll(k)%1000000007;
		ans%=1000000007;
	}while(next_permutation(all(b)));
	cout<<ans<<endl;
}
0