結果
| 問題 |
No.147 試験監督(2)
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-04-19 10:40:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 895 bytes |
| コンパイル時間 | 591 ms |
| コンパイル使用メモリ | 73,596 KB |
| 実行使用メモリ | 226,888 KB |
| 最終ジャッジ日時 | 2024-10-04 14:03:36 |
| 合計ジャッジ時間 | 8,125 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | MLE * 1 -- * 3 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000
#define MOD 1000000007
typedef long long ll;
map<ll,int> m;
ll dfs(ll c) {
if (m.count(c))
return m[c];
if (c < 1)
return m[c] = 1;
else if (c == 1)
return m[c] = 2;
else
return m[c] = (dfs(c/2)*dfs(c-c/2-1)%MOD + dfs(c/2-1)*dfs(c-c/2-2)%MOD) % MOD;
}
int main() {
int i, n;
ll ans;
cin >> n;
ans = 1;
rep (i,n) {
ll c, d;
string sd;
cin >> c >> sd;
d = 0;
for (auto chr : sd)
d = (d*10 + chr - '0') % MOD;
ans *= dfs(c) * d % MOD;
ans %= MOD;
}
cout << ans << endl;
return 0;
}
h_noson