Submission #00101


ソースコード

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
94
95
#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]) {
rep(j, x.se) func(ans1, i, x.fi);
}
}
if(t.fi == -1) {
assert(n == 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;
functional[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 21:01:15
言語 C++11
状態 Wrong Answer
得点 0
ソースコード長 1525 Byte
最大実行時間 152 ms
最大メモリ使用量 7668 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01_sample1.in AC 11 ms 480 KB
1
01_sample2.in AC 13 ms 460 KB
1
01_sample3.in AC 12 ms 312 KB
1
02_handmake1.in AC 14 ms 536 KB
1
02_handmake2.in AC 14 ms 384 KB
1
02_handmake3.in AC 21 ms 488 KB
1
02_handmake4.in AC 17 ms 460 KB
1
02_handmake5.in AC 13 ms 432 KB
1
02_handmake6.in AC 12 ms 536 KB
1
02_handmake7.in AC 13 ms 640 KB
1
02_handmake8.in AC 12 ms 492 KB
1
02_handmake9.in AC 11 ms 592 KB
1
03_random1.in AC 10 ms 568 KB
1
03_random2.in AC 10 ms 536 KB
1
03_random3.in AC 10 ms 632 KB
1
03_random4.in AC 10 ms 608 KB
1
03_random5.in AC 14 ms 580 KB
1
03_random6.in AC 13 ms 556 KB
1
04_random1.in AC 11 ms 524 KB
1
04_random2.in AC 13 ms 488 KB
1
04_random3.in AC 12 ms 452 KB
1
04_random4.in WA 15 ms 544 KB
1
04_random5.in WA 14 ms 512 KB
1
04_random6.in WA 17 ms 604 KB
1
05_random1.in AC 125 ms 7608 KB
1
05_random2.in AC 127 ms 7584 KB
1
05_random3.in AC 152 ms 7560 KB
1
05_random4.in AC 146 ms 7668 KB
1
06_random1.in AC 152 ms 7644 KB
1
06_random3.in AC 141 ms 7616 KB
1