結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2022-06-11 02:18:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 771 bytes |
| コンパイル時間 | 1,787 ms |
| コンパイル使用メモリ | 173,720 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2024-09-21 09:35:44 |
| 合計ジャッジ時間 | 10,857 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 8 |
ソースコード
/**
* @FileName a.cpp
* @Author kanpurin
* @Created 2022.06.11 02:18:44
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int n;cin >> n;
ll m;cin >> m;
map<ll,int> mp;
for (int i = 0; i < n; i++) {
ll a;cin >> a;
mp[a%m]++;
}
int ans = 0;
for (auto p : mp) {
if (p.first == 0) continue;
if (mp.find(m-p.first) != mp.end()) {
if (p.first>=m-p.first) continue;
ans += max(p.second,mp[m-p.first]);
}
else {
ans += p.second;
}
cerr << ans << " " << p.first << endl;
}
if (mp.find(0) != mp.end()) ans++;
if (m%2==0&&mp.find(m)!=mp.end()) ans++;
cout << ans << endl;
return 0;
}
🍮かんプリン