結果
問題 | No.1972 Modulo Set |
ユーザー |
|
提出日時 | 2022-06-16 02:20:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 123 ms / 2,000 ms |
コード長 | 883 bytes |
コンパイル時間 | 1,012 ms |
コンパイル使用メモリ | 104,780 KB |
実行使用メモリ | 14,848 KB |
最終ジャッジ日時 | 2024-10-05 07:44:00 |
合計ジャッジ時間 | 4,777 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:37:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 37 | for(auto [key,value]:mp){ | ^
ソースコード
#include <iostream> #include <stdio.h> #include <cmath> #include <vector> #include <tuple> #include <bitset> #include <map> #include <queue> #include <time.h> #include <utility> #include <numeric> #include <deque> #include <cassert> #include <sstream> #include <cctype> #include <unordered_map> #include <algorithm> #include <chrono> #define ll long long #include <time.h> #define mod % 1000000007 #define rep(i,n) for(long long i = 0;i < n;i ++) ll MAX = 5'000'000'000'000'000'000LL; using namespace std; int main(){ ll n,m; cin >> n >> m; map<ll,ll> mp; for(int i = 0;i < n;i ++){ ll a; cin >> a; mp[a%m] ++; } ll ans = 0; for(auto [key,value]:mp){ if(key == 0 or key*2 == m){ ans ++; }else{ if(mp[m-key]<value)ans += value; if(mp[m-key]== value and m-key>key) ans += value; } } cout << ans << endl; return 0; }