結果
問題 | No.1164 GCD Products hard |
ユーザー | tonegawa |
提出日時 | 2020-08-15 12:17:20 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 741 bytes |
コンパイル時間 | 697 ms |
コンパイル使用メモリ | 73,572 KB |
実行使用メモリ | 138,752 KB |
最終ジャッジ日時 | 2024-04-19 00:37:45 |
合計ジャッジ時間 | 50,328 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,116 ms
138,752 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 1,827 ms
47,872 KB |
testcase_03 | AC | 484 ms
18,688 KB |
testcase_04 | AC | 491 ms
19,840 KB |
testcase_05 | AC | 2,194 ms
56,448 KB |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | AC | 1,769 ms
50,048 KB |
testcase_10 | AC | 480 ms
17,408 KB |
testcase_11 | AC | 1,982 ms
52,864 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 1,523 ms
41,856 KB |
testcase_14 | AC | 1,587 ms
49,280 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 1,752 ms
53,632 KB |
testcase_17 | AC | 2,167 ms
55,168 KB |
testcase_18 | AC | 1,854 ms
50,560 KB |
testcase_19 | AC | 522 ms
20,864 KB |
testcase_20 | AC | 919 ms
28,800 KB |
testcase_21 | TLE | - |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
ソースコード
#include <iostream> #include <vector> #define vll vector<ll> using namespace std; typedef long long int ll; #define P 1000000007 #define Q 1000000006 int main() { ll a, b, n, ans = 1; scanf("%lld %lld %lld", &a, &b, &n); a--; ll cnt[b+1]; ll ret, num, x; for(int g=b;g>=2;g--){ ll tmp = b/g - a/g; ret = 1, num = tmp, x = n; for(;x;){ if(x&1) ret = (ret*num)%Q; num=(num*num)%Q; x>>=1; } cnt[g] = ret; for(int k=2*g;k<=b;k+=g) cnt[g] -= cnt[k]; ll t = abs(cnt[g])/Q + 1; cnt[g] = (cnt[g] + t*Q)%Q; ret = 1, num = g, x = cnt[g]; for(;x;){ if(x&1) ret = (ret*num)%P; num=(num*num)%P; x>>=1; } ans = (ans * ret)%P; } printf("%lld\n", ans); }