結果
問題 | No.1972 Modulo Set |
ユーザー | magsta |
提出日時 | 2021-08-04 11:46:06 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 2,362 ms |
コンパイル使用メモリ | 181,584 KB |
実行使用メモリ | 17,340 KB |
最終ジャッジ日時 | 2023-10-21 06:03:08 |
合計ジャッジ時間 | 6,354 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 26 ms
4,348 KB |
testcase_06 | WA | - |
testcase_07 | AC | 70 ms
4,872 KB |
testcase_08 | AC | 29 ms
4,348 KB |
testcase_09 | WA | - |
testcase_10 | AC | 24 ms
4,348 KB |
testcase_11 | AC | 67 ms
4,872 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { long long N, M; cin >> N >> M; vector<long long> A(N); for (int i = 0; i < N; i++) cin >> A[i]; map<long long, long long> Map; set<long long> Set; for (int i = 0; i < N; i++) { Map[A[i] % M]++; Set.insert(A[i] % M); } long long count = 0; while (!Set.empty()) { long long a = *Set.begin(); Set.erase(Set.begin()); if (a == 0 || a * 2 == M) { count++; } else if (a * 2 < M) { count += max(Map[a], Map[M - a]); } } cout << count << endl; }