結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-06-10 21:55:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 521 bytes |
| コンパイル時間 | 3,023 ms |
| コンパイル使用メモリ | 253,240 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2024-09-21 06:14:59 |
| 合計ジャッジ時間 | 7,773 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 19 RE * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N,M;
cin>>N>>M;
vector<int> S(N);
map<int,int> s;
for(int i=0;i<N;i++){
cin>>S[i];
S[i] %= M;
if(!s.count(S[i])) s[S[i]] = 0;
s[S[i]]++;
}
int ans = 0;
for(auto x:s){
int a = x.first;
int b = x.second;
if(a == 0 && s.count(0)) ans++;
else if(!s.count(M-a)) ans += b;
else if(a == M-a) ans += b;
else if(a < M-a) ans += max(S[M-a],b);
}
cout<<ans<<endl;
}
keisuke6