提交记录 11022


用户 题目 状态 得分 用时 内存 语言 代码长度
YeahPotato noip18e. 【NOIP2018】填数游戏 Accepted 100 44.18 us 36 KB C++ 999 B
提交时间 评测时间
2019-10-20 16:53:45 2020-08-01 02:37:27
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int n, m, f; ll res1, res2, res3, res4, _, ans1;
inline int qpow(ll x, int y) {
	ll t = 1;
	for (; y; y>>=1) {
		if (y & 1) t = t * x % MOD;
		x = x * x % MOD;
	} return t;
}
int main() {
//	freopen ("game.in", "r", stdin);
//	freopen ("game.out", "w", stdout);
	cin >> n >> m;
	if (n > m) swap(n, m);
	if (n == 1) return printf ("%d\n", qpow(2, m)), 0;
	if (n == 2) return printf ("%lld\n", 12ll * qpow(3, m - 2) % MOD), 0;
	if (n == 3) return printf ("%lld\n", 112ll * qpow(3, m - 3) % MOD), 0;
	for (int i=2; i<=n-3; i++) f = (4ll * f + 20) % MOD;
	res2 = qpow(2, 3 * n - 7), res1 = 16ll * res2 % MOD, res2 = 5ll * res2 % MOD;
	_ = qpow(2, n), ans1 = _ * (2 * f + 15) % MOD;
	if (n == m) return printf ("%lld\n", (res1 + res2 + ans1) % MOD), 0;
	res3 = _ * (3ll * f + 20) % MOD, res4 = _ * (3ll * f + 22) % MOD;
	return printf ("%lld\n", ((res1 + res2) * 3 + res3 + res4) * qpow(3, m - n - 1) % MOD), 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #134.34 us36 KBAcceptedScore: 5

Testcase #244.18 us36 KBAcceptedScore: 5

Testcase #336.59 us36 KBAcceptedScore: 5

Testcase #435.1 us36 KBAcceptedScore: 5

Testcase #534.58 us36 KBAcceptedScore: 5

Testcase #635.35 us36 KBAcceptedScore: 5

Testcase #735.02 us36 KBAcceptedScore: 5

Testcase #834.48 us36 KBAcceptedScore: 5

Testcase #934.56 us36 KBAcceptedScore: 5

Testcase #1034.33 us36 KBAcceptedScore: 5

Testcase #1135.03 us36 KBAcceptedScore: 5

Testcase #1234.86 us36 KBAcceptedScore: 5

Testcase #1334.68 us36 KBAcceptedScore: 5

Testcase #1434.8 us36 KBAcceptedScore: 5

Testcase #1535.42 us36 KBAcceptedScore: 5

Testcase #1634.96 us36 KBAcceptedScore: 5

Testcase #1743.61 us36 KBAcceptedScore: 5

Testcase #1834.61 us36 KBAcceptedScore: 5

Testcase #1936.42 us36 KBAcceptedScore: 5

Testcase #2033.8 us36 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:33:09 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠