Submission #00074


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define reep(i,a,b) for(int i=a; i<b; i++)
#define MOD 1000000007LL
#define fi first
#define se second
using ll = long long;
using pll = pair<ll,ll>;
ll powmod(ll x,ll y){
ll a=1;
while(y){
if(y&1) a=a*x%MOD;
x=x*x%MOD;
y>>=1;
}
return a;
}
void add(ll &x, ll y){
(x+=y+MOD)%=MOD;
}
void tim(ll &x, ll y){
(x*=y)%=MOD;
}
ll g(ll a, ll b){
ll ret=powmod(10, b);
add(ret, -1);
tim(ret, powmod(9, MOD-2));
tim(ret, a);
return ret;
}
void func(ll &x, ll a, ll b){
tim(x, powmod(10, b));
add(x, g(a,b));
}
int main(){
int n;
cin>>n;
vector<map<ll,ll>> ma(10);
rep(i,n){
ll a,b;
cin>>a>>b;
ma[a][b]++;
}
ll ans1 = 0;
pll t(-1,-1);
reep(i,1,10){
if(ma[i].size()==0) continue;
for(pll x: ma[i]){
func(ans1, i, x.fi);
t.fi = x.fi;
t.se = x.se;
ma[i][x.fi]--;
break;
}
break;
}
rep(i,10){
for(pll x: ma[i]){
if(x.se == 0) continue;
rep(j,x.se) func(ans1, i, x.fi);
}
}
if(t.fi == -1){
t.se = 1;
}
cout<<ans1<<endl;
ll ans2 = t.se;
vector<ll> functional(n+10);
functional[0] = 1;
reep(i,1,n+10) {
functional[i] = functional[i-1] * i % MOD;
}
rep(i,10){
ll sum = 0;
for(pll x: ma[i]){
sum += x.se;
}
tim(ans2, functional[sum]);
}
cout<<ans2<<endl;
}

ステータス

項目 データ
問題 0003 - repdigit
ユーザー名 yellow_jam
投稿日時 2017-07-07 20:48:44
言語 C++11
状態 Wrong Answer
得点 0
ソースコード長 1421 Byte
最大実行時間 146 ms
最大メモリ使用量 7696 KB

セット

セット 得点 Cases
1 ALL 0 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01_sample1.in AC 14 ms 476 KB
1
01_sample2.in AC 11 ms 448 KB
1
01_sample3.in AC 12 ms 424 KB
1
02_handmake1.in AC 11 ms 524 KB
1
02_handmake2.in AC 14 ms 500 KB
1
02_handmake3.in AC 15 ms 472 KB
1
02_handmake4.in AC 12 ms 444 KB
1
02_handmake5.in AC 13 ms 416 KB
1
02_handmake6.in AC 23 ms 388 KB
1
02_handmake7.in AC 15 ms 364 KB
1
02_handmake8.in AC 16 ms 468 KB
1
02_handmake9.in AC 13 ms 568 KB
1
03_random1.in AC 14 ms 412 KB
1
03_random2.in AC 16 ms 516 KB
1
03_random3.in AC 14 ms 488 KB
1
03_random4.in AC 16 ms 580 KB
1
03_random5.in AC 21 ms 676 KB
1
03_random6.in AC 11 ms 644 KB
1
04_random1.in AC 15 ms 736 KB
1
04_random2.in AC 14 ms 572 KB
1
04_random3.in AC 12 ms 664 KB
1
04_random4.in WA 14 ms 756 KB
1
04_random5.in WA 14 ms 716 KB
1
04_random6.in WA 12 ms 688 KB
1
05_random1.in AC 137 ms 7696 KB
1
05_random2.in AC 146 ms 7672 KB
1
05_random3.in AC 137 ms 7648 KB
1
05_random4.in AC 136 ms 7624 KB
1
06_random1.in AC 120 ms 7608 KB
1
06_random3.in AC 124 ms 7584 KB
1