結果
問題 | No.1276 3枚のカード |
ユーザー |
![]() |
提出日時 | 2020-10-30 22:28:53 |
言語 | C++17 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 1,654 ms / 2,000 ms |
コード長 | 2,986 bytes |
コンパイル時間 | 1,794 ms |
使用メモリ | 6,284 KB |
最終ジャッジ日時 | 2023-02-21 14:16:43 |
合計ジャッジ時間 | 50,683 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,268 KB |
testcase_01 | AC | 1 ms
6,192 KB |
testcase_02 | AC | 1 ms
6,252 KB |
testcase_03 | AC | 1 ms
6,188 KB |
testcase_04 | AC | 2 ms
6,216 KB |
testcase_05 | AC | 1 ms
6,164 KB |
testcase_06 | AC | 1 ms
6,188 KB |
testcase_07 | AC | 1 ms
6,272 KB |
testcase_08 | AC | 1 ms
6,248 KB |
testcase_09 | AC | 2 ms
6,176 KB |
testcase_10 | AC | 1,394 ms
6,176 KB |
testcase_11 | AC | 651 ms
6,196 KB |
testcase_12 | AC | 834 ms
6,192 KB |
testcase_13 | AC | 871 ms
6,196 KB |
testcase_14 | AC | 75 ms
6,268 KB |
testcase_15 | AC | 701 ms
6,184 KB |
testcase_16 | AC | 1,520 ms
6,192 KB |
testcase_17 | AC | 811 ms
6,172 KB |
testcase_18 | AC | 611 ms
6,176 KB |
testcase_19 | AC | 1,002 ms
6,172 KB |
testcase_20 | AC | 580 ms
6,276 KB |
testcase_21 | AC | 604 ms
6,268 KB |
testcase_22 | AC | 1,549 ms
6,268 KB |
testcase_23 | AC | 64 ms
6,196 KB |
testcase_24 | AC | 948 ms
6,212 KB |
testcase_25 | AC | 310 ms
6,176 KB |
testcase_26 | AC | 1,178 ms
6,192 KB |
testcase_27 | AC | 1,357 ms
6,168 KB |
testcase_28 | AC | 1,301 ms
6,272 KB |
testcase_29 | AC | 742 ms
6,180 KB |
testcase_30 | AC | 138 ms
6,176 KB |
testcase_31 | AC | 60 ms
6,192 KB |
testcase_32 | AC | 334 ms
6,196 KB |
testcase_33 | AC | 18 ms
6,176 KB |
testcase_34 | AC | 229 ms
6,284 KB |
testcase_35 | AC | 214 ms
6,256 KB |
testcase_36 | AC | 13 ms
6,200 KB |
testcase_37 | AC | 199 ms
6,208 KB |
testcase_38 | AC | 131 ms
6,208 KB |
testcase_39 | AC | 352 ms
6,212 KB |
testcase_40 | AC | 1,480 ms
6,172 KB |
testcase_41 | AC | 1,215 ms
6,184 KB |
testcase_42 | AC | 1,319 ms
6,196 KB |
testcase_43 | AC | 1,147 ms
6,252 KB |
testcase_44 | AC | 1,640 ms
6,192 KB |
testcase_45 | AC | 1,483 ms
6,172 KB |
testcase_46 | AC | 1,482 ms
6,180 KB |
testcase_47 | AC | 1,216 ms
6,180 KB |
testcase_48 | AC | 1,166 ms
6,164 KB |
testcase_49 | AC | 1,326 ms
6,196 KB |
testcase_50 | AC | 1,468 ms
6,172 KB |
testcase_51 | AC | 1,259 ms
6,184 KB |
testcase_52 | AC | 1,073 ms
6,176 KB |
testcase_53 | AC | 1,267 ms
6,264 KB |
testcase_54 | AC | 1,463 ms
6,192 KB |
testcase_55 | AC | 1,123 ms
6,168 KB |
testcase_56 | AC | 1,086 ms
6,180 KB |
testcase_57 | AC | 1,399 ms
6,212 KB |
testcase_58 | AC | 1,456 ms
6,184 KB |
testcase_59 | AC | 1,270 ms
6,168 KB |
testcase_60 | AC | 1,654 ms
6,200 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcountll #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC #define debug(x) std::cout << #x << ": " << x << '\n'; const int MOD = 1e9+7, N = 1; //need define int long long int mod(int n) { n %= MOD; if (n < 0) return n + MOD; else return n; } int fp(int a, int p) { int ans = 1, c = a; for (int i = 0; (1ll << i) <= p; ++i) { if ((p >> i) & 1) ans = mod(ans * c); c = mod(c * c); } return ans; } int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); } struct M { ll x; M (int x_) { x = mod(x_); } M () { x = 0; } M operator + (M y) { int ans = x + y.x; if (ans >= MOD) ans -= MOD; return M(ans); } M operator - (M y) { int ans = x - y.x; if (ans < 0) ans += MOD; return M(ans); } M operator * (M y) { return M(x * y.x % MOD); } M operator / (M y) { return M(x * fp(y.x, MOD - 2) % MOD); } M operator + (int y) { return (*this) + M(y); } M operator - (int y) { return (*this) - M(y); } M operator * (int y) { return (*this) * M(y); } M operator / (int y) { return (*this) / M(y); } M operator ^ (int p) { return M(fp(x, p)); } void operator += (M y) { *this = *this + y; } void operator -= (M y) { *this = *this - y; } void operator *= (M y) { *this = *this * y; } void operator /= (M y) { *this = *this / y; } void operator += (int y) { *this = *this + y; } void operator -= (int y) { *this = *this - y; } void operator *= (int y) { *this = *this * y; } void operator /= (int y) { *this = *this / y; } void operator ^= (int p) { *this = *this ^ p; } }; M f(int i, int n) { M ans(0); while (i <= n) { int cur = n/i; int r = n/cur+1; int len = r - i; ans += (cur - 1) * len; i = r; } return ans; } M get1(int n) { int i = 1; M ans(0); while (i <= n) { int cur = n/i; int r = n/cur+1; int len = r - i; ans += M(cur - 1) * (cur - 2) * len; i = r; } return ans; } M get2(int n) { int i = 1; M ans(0); while (i <= n) { int cur = n/i; int r = n/cur+1; int len = r - i; ans += f(2, cur) * len; i = r; } return ans; } signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else #define endl '\n' ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20); #endif int n; cin >> n; M ans(0); ans = f(1, n) * (n - 2); ans -= get1(n); ans -= get2(n); cout << ans.x << endl; #ifdef HOME cout << Time << endl; #endif }