結果
問題 | No.1844 Divisors Sum Sum |
ユーザー | Abhishek Angale |
提出日時 | 2022-02-19 00:35:07 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 136 ms / 3,000 ms |
コード長 | 3,722 bytes |
コンパイル時間 | 2,380 ms |
コンパイル使用メモリ | 190,148 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 10:06:02 |
合計ジャッジ時間 | 5,569 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
6,816 KB |
testcase_01 | AC | 131 ms
6,944 KB |
testcase_02 | AC | 131 ms
6,940 KB |
testcase_03 | AC | 130 ms
6,944 KB |
testcase_04 | AC | 136 ms
6,940 KB |
testcase_05 | AC | 131 ms
6,944 KB |
testcase_06 | AC | 131 ms
6,944 KB |
testcase_07 | AC | 132 ms
6,940 KB |
testcase_08 | AC | 130 ms
6,944 KB |
testcase_09 | AC | 131 ms
6,944 KB |
testcase_10 | AC | 119 ms
6,940 KB |
testcase_11 | AC | 27 ms
6,940 KB |
testcase_12 | AC | 91 ms
6,944 KB |
testcase_13 | AC | 14 ms
6,940 KB |
testcase_14 | AC | 43 ms
6,944 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | AC | 2 ms
6,940 KB |
testcase_24 | AC | 2 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 1 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,940 KB |
testcase_32 | AC | 2 ms
6,944 KB |
testcase_33 | AC | 2 ms
6,944 KB |
testcase_34 | AC | 2 ms
6,944 KB |
testcase_35 | AC | 1 ms
6,940 KB |
testcase_36 | AC | 2 ms
6,940 KB |
testcase_37 | AC | 2 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // oset Operations: order_of_key(k) -> Number of elements strictly smaller than k, find_by_order(k) -> kth element in the set #define ull unsigned long long int #define int long long int #define pb push_back #define eb emplace_back #define all(x) x.begin(),x.end() #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vb vector<bool> #define vd vector<double> #define vll vector<ll> #define vpii vector<pii> #define vpll vector<pll> #define vvi vector<vi> #define vvll vector<vll> #define vvb vector<vb> #define vs vector<string> #define pull pair<ull, ull> #define F first #define S second #define m_p make_pair const long double PI = 3.141592653589793238462643383279502884197169399; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); string to_string(const string& s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(vector<bool> v) { bool first = true; string res = "{"; for (int i = 0; i < static_cast<int>(v.size()); i++) { if (!first) { res += ", "; } first = false; res += to_string(v[i]); } res += "}"; return res; } template <size_t N> string to_string(bitset<N> v) { string res = ""; for (size_t i = 0; i < N; i++) { res.push_back(static_cast<char>('0' + v[i])); } return res; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p) { return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")"; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifndef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 0 #endif // Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1)) const int mod = 1e9 + 7; long long binpow(long long a, long long b, long long m) { a %= m; long long res = 1; while (b > 0) { if (b & 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } void solve(){ int n; cin >> n; int ans = 1; for(int i = 0; i < n; i++){ int x, n; cin >> x >> n; int mul = (binpow(x, n + 1, mod) - 1 + mod) % mod; mul *= x; mul %= mod; mul *= binpow(x - 1, mod - 2, mod) % mod; mul %= mod; mul -= (n + 1); mul += mod; mul %= mod; mul *= binpow(x - 1, mod - 2, mod) % mod; mul %= mod; ans *= mul; ans %= mod; } cout << ans; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed << setprecision(10); int tt=1; // cin >> tt; while(tt--){ solve(); } }