結果

問題 No.1086 桁和の桁和2
ユーザー kotatsugamekotatsugame
提出日時 2020-06-19 22:51:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 695 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 65,924 KB
実行使用メモリ 5,708 KB
最終ジャッジ日時 2023-09-16 15:04:43
合計ジャッジ時間 6,444 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 136 ms
5,644 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 85 ms
4,888 KB
testcase_11 AC 24 ms
4,376 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 108 ms
5,260 KB
testcase_14 AC 68 ms
4,580 KB
testcase_15 AC 32 ms
4,380 KB
testcase_16 AC 182 ms
5,012 KB
testcase_17 AC 16 ms
4,376 KB
testcase_18 AC 250 ms
5,620 KB
testcase_19 AC 205 ms
5,172 KB
testcase_20 AC 26 ms
4,380 KB
testcase_21 AC 177 ms
5,024 KB
testcase_22 AC 249 ms
5,636 KB
testcase_23 AC 152 ms
4,868 KB
testcase_24 AC 106 ms
4,376 KB
testcase_25 AC 209 ms
5,216 KB
testcase_26 AC 172 ms
4,972 KB
testcase_27 AC 124 ms
4,556 KB
testcase_28 AC 106 ms
4,384 KB
testcase_29 AC 116 ms
4,448 KB
testcase_30 AC 256 ms
5,676 KB
testcase_31 AC 256 ms
5,652 KB
testcase_32 AC 257 ms
5,700 KB
testcase_33 AC 256 ms
5,636 KB
testcase_34 AC 257 ms
5,708 KB
testcase_35 AC 137 ms
5,684 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N;
long L[1<<17],R[1<<17],D[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>L[i];
	for(int i=0;i<N;i++)cin>>R[i];
	int zc=0;
	for(int i=0;i<N;i++)
	{
		cin>>D[i];
		if(D[i]==0)zc++;
	}
	if(zc>0)
	{
		if(zc==N)cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	long ans=1;
	long inv9=power(9,mod-2);
	bool nz=false;
	for(int i=0;i<N;i++)
	{
		if(D[i]==0)
		{
			if(nz)ans=0;
		}
		else
		{
			nz=true;
			long now=(power(10,R[i])-power(10,L[i])+mod)%mod*inv9%mod;
			if(i>0&&D[i-1]==D[i])now=(now+1)%mod;
			ans=ans*now%mod;
		}
	}
	cout<<ans<<endl;
}
0