結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー rickyorangerickyorange
提出日時 2021-07-30 21:19:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,092 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 171,312 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-14 03:05:35
合計ジャッジ時間 4,239 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 27 ms
4,352 KB
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];
		}
		ans+=stoll(k)%1000000007;
		ans%=1000000007;
	}while(next_permutation(all(b)));
	cout<<ans<<endl;
}
0