結果
問題 | No.2260 Adic Sum |
ユーザー | ruthen |
提出日時 | 2023-04-14 23:50:26 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 893 ms / 2,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 2,201 ms |
コンパイル使用メモリ | 205,552 KB |
実行使用メモリ | 63,724 KB |
最終ジャッジ日時 | 2024-04-18 21:25:40 |
合計ジャッジ時間 | 7,329 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 3 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 3 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 3 ms
5,376 KB |
testcase_13 | AC | 3 ms
5,376 KB |
testcase_14 | AC | 13 ms
5,376 KB |
testcase_15 | AC | 18 ms
6,100 KB |
testcase_16 | AC | 11 ms
5,376 KB |
testcase_17 | AC | 21 ms
6,412 KB |
testcase_18 | AC | 447 ms
38,772 KB |
testcase_19 | AC | 537 ms
41,052 KB |
testcase_20 | AC | 280 ms
27,680 KB |
testcase_21 | AC | 329 ms
29,232 KB |
testcase_22 | AC | 225 ms
24,624 KB |
testcase_23 | AC | 110 ms
15,592 KB |
testcase_24 | AC | 462 ms
37,912 KB |
testcase_25 | AC | 32 ms
8,692 KB |
testcase_26 | AC | 35 ms
8,556 KB |
testcase_27 | AC | 38 ms
8,596 KB |
testcase_28 | AC | 35 ms
8,564 KB |
testcase_29 | AC | 35 ms
8,576 KB |
testcase_30 | AC | 36 ms
6,744 KB |
testcase_31 | AC | 156 ms
9,296 KB |
testcase_32 | AC | 164 ms
9,424 KB |
testcase_33 | AC | 34 ms
9,016 KB |
testcase_34 | AC | 98 ms
23,260 KB |
testcase_35 | AC | 893 ms
63,724 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef _RUTHEN #include <debug.hpp> #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template <class T> using V = vector<T>; int main() { ios::sync_with_stdio(false); cin.tie(0); long long N, P; cin >> N >> P; V<long long> A(N); rep(i, N) cin >> A[i]; V<long long> B; long long c = 1; while (c <= 1000000000LL / P) { B.push_back(c * P); c *= P; } show(B); int K = B.size(); long long ans = 0; V<unordered_map<long long, int>> r(K); rep(i, N) { rep(j, K) { ans += r[j][A[i] % B[j]]; r[j][A[i] % B[j]]++; } } cout << ans << '\n'; return 0; }