結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー karinohitokarinohito
提出日時 2021-07-30 21:11:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,484 bytes
コンパイル時間 1,774 ms
コンパイル使用メモリ 169,872 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-14 02:37:03
合計ジャッジ時間 10,067 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,368 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 2 ms
4,372 KB
testcase_12 AC 1 ms
4,368 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 1 ms
4,368 KB
testcase_18 AC 1 ms
4,368 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,372 KB
testcase_21 WA -
testcase_22 AC 2 ms
4,372 KB
testcase_23 AC 2 ms
4,368 KB
testcase_24 AC 1 ms
4,368 KB
testcase_25 AC 1 ms
4,372 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,372 KB
testcase_28 AC 2 ms
4,368 KB
testcase_29 AC 2 ms
4,368 KB
testcase_30 AC 2 ms
4,368 KB
testcase_31 AC 2 ms
4,372 KB
testcase_32 AC 2 ms
4,372 KB
testcase_33 AC 2 ms
4,372 KB
testcase_34 WA -
testcase_35 AC 1 ms
4,372 KB
testcase_36 AC 1 ms
4,372 KB
testcase_37 WA -
testcase_38 AC 2 ms
4,368 KB
testcase_39 AC 1 ms
4,368 KB
testcase_40 AC 1 ms
4,368 KB
testcase_41 AC 2 ms
4,368 KB
testcase_42 AC 1 ms
4,368 KB
testcase_43 WA -
testcase_44 AC 1 ms
4,368 KB
testcase_45 AC 2 ms
4,372 KB
testcase_46 WA -
testcase_47 AC 2 ms
4,368 KB
testcase_48 AC 2 ms
4,368 KB
testcase_49 AC 2 ms
4,368 KB
testcase_50 AC 2 ms
4,372 KB
testcase_51 AC 2 ms
4,368 KB
testcase_52 AC 2 ms
4,372 KB
testcase_53 AC 2 ms
4,368 KB
testcase_54 AC 1 ms
4,372 KB
testcase_55 AC 1 ms
4,368 KB
testcase_56 AC 1 ms
4,368 KB
testcase_57 AC 2 ms
4,368 KB
testcase_58 AC 1 ms
4,368 KB
testcase_59 AC 1,971 ms
4,368 KB
testcase_60 TLE -
testcase_61 AC 859 ms
4,368 KB
testcase_62 AC 624 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <atcoder/all>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
//using namespace atcoder;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;
vector<ll> fact, factinv, inv;

ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	if (n < k) return 0;
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}
int main() {
	ll N;
	cin>>N;
	//prenCkModp(N);
	vll C(9);
	ll S=0;
	ll P=8;
	ll G=-1;
	rep(i,9){
		cin>>C[i];
		if(C[i]>0){
			G++;
			if((i+1)%2!=0)P=1;
			else if((i+1)%4!=0)P=gcd(P,2);
			else if((i+1)%8!=0)P=gcd(P,4);
		}
		S+=C[i]*(i+1);
	}
	
	ll mod=1e9+7;
	if(G==0){
		rep(i,9){
			if(C[i]!=0){
				ll k=1;
				ll an=0;
				rep(j,C[i]){
					an+=k*(i+1);
					k*=10;
					k%=mod;
					an%=mod;
				}
				cout<<an<<endl;
				return 0;
			}
		}
	}
	if(S%9==0){
		cout<<P*9<<endl;
	}
	else if(S%3==0){
		cout<<P*3<<endl;

	}
	else cout<<P<<endl;
	

}
0