結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-11 03:06:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 500 bytes |
| コンパイル時間 | 1,760 ms |
| コンパイル使用メモリ | 173,336 KB |
| 実行使用メモリ | 14,848 KB |
| 最終ジャッジ日時 | 2024-09-21 10:25:24 |
| 合計ジャッジ時間 | 5,918 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 34 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long N,M;
cin>>N>>M;
map<long long,int>cnt;
for(int i=0;i<N;i++){
long long A;
cin>>A;
cnt[A%M]+=1;
cnt[(M-A%M)%M]+=0;
cout<<A%M<<' ';
}
cout<<'\n';
int ans=0;
for(auto i:cnt){
if(i.first>M/2)continue;
if(i.first*2==M||i.first==0){
ans+=min(1,i.second);
}else{
ans+=max(i.second,cnt[M-i.first]);
}
}
cout<<ans<<'\n';
}