結果

問題 No.1972 Modulo Set
ユーザー Gorin2006Gorin2006
提出日時 2022-11-18 15:48:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,496 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 179,752 KB
実行使用メモリ 16,008 KB
最終ジャッジ日時 2023-10-20 01:59:57
合計ジャッジ時間 5,053 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,348 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 3 ms
4,348 KB
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 AC 40 ms
7,976 KB
testcase_29 AC 62 ms
10,148 KB
testcase_30 AC 88 ms
12,544 KB
testcase_31 AC 6 ms
4,348 KB
testcase_32 AC 80 ms
11,724 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
    ans[t]=max(p.second,data[m-p.second]);
  }
  ll s=0;
  for (auto p:ans) s+=p.second;
  cout << s << endl;
  system("pause");
}
0