結果

問題 No.1972 Modulo Set
ユーザー Gorin2006Gorin2006
提出日時 2022-11-18 16:03:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,602 bytes
コンパイル時間 1,851 ms
コンパイル使用メモリ 180,212 KB
実行使用メモリ 21,340 KB
最終ジャッジ日時 2023-10-20 02:10:57
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 6 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 8 ms
4,488 KB
testcase_14 AC 8 ms
4,536 KB
testcase_15 WA -
testcase_16 AC 79 ms
9,236 KB
testcase_17 AC 26 ms
5,388 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 69 ms
9,356 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 62 ms
9,096 KB
testcase_23 AC 145 ms
18,392 KB
testcase_24 AC 55 ms
9,720 KB
testcase_25 AC 83 ms
12,856 KB
testcase_26 WA -
testcase_27 AC 150 ms
19,324 KB
testcase_28 AC 58 ms
9,980 KB
testcase_29 AC 93 ms
13,172 KB
testcase_30 AC 128 ms
16,696 KB
testcase_31 AC 7 ms
4,416 KB
testcase_32 AC 119 ms
15,492 KB
testcase_33 AC 173 ms
21,340 KB
testcase_34 AC 176 ms
21,328 KB
testcase_35 AC 179 ms
21,332 KB
testcase_36 AC 176 ms
21,332 KB
権限があれば一括ダウンロードができます

ソースコード

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;
    if (m==2*p.first) {
      ans[t]=1;
      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");
}
0