結果

問題 No.1972 Modulo Set
ユーザー Gorin2006Gorin2006
提出日時 2022-11-18 15:53:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,540 bytes
コンパイル時間 1,646 ms
コンパイル使用メモリ 179,900 KB
実行使用メモリ 21,248 KB
最終ジャッジ日時 2024-09-19 21:52:53
合計ジャッジ時間 4,880 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
//#include <atcoder/all>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//using mint2 = modint998244353;
typedef long long ll;
#define rep1(i, m, n) for(int i = m; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i <= (int)(n); i++)
#define all(x) x.begin(), x.end()
#define rall(x) xkkkk.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if(a < b) {a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if(a > b) {a = b; return true; } return false; }
const ll INF = 1LL << 60;
//#define _GLIBCXX_DEBUG
// 使include
// const char newl='\n';
int main() {
ll n,m; cin >> n >> m;
vector<ll> a(n);
for (int i=0; i<n; i++) {
cin >> a[i];
a[i]%=m;
}
map<ll,ll> data;
for (int i=0; i<n; i++) data[a[i]]++;
map<ll,ll> ans;
set<ll> idx;
for (auto p:data) {
/*
if (idx.count(p.first)) continue;
if (!data.count(m-p.first)) {
ans+=p.second;
idx.insert(p.first);
continue;
}
if (p.second>=data[m-p.first]) {
ans+=p.second;
idx.insert(p.first);
idx.insert(m-p.first);
}
*/
ll t=max(p.first,m-p.first);
if (ans.count(t)) continue;
ans[t]=max(p.second,data[m-p.first]);
int c=0;
}
ll s=0;
for (auto p:ans) s+=p.second;
cout << s << endl;
system("pause");
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0