結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-27 22:35:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 543 bytes |
| コンパイル時間 | 808 ms |
| コンパイル使用メモリ | 87,436 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 16:02:53 |
| 合計ジャッジ時間 | 1,316 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int N;
long D,T;
main()
{
cin>>N>>D>>T;
map<long,vector<long> >M;
for(int i=0;i<N;i++)
{
long X;cin>>X;
M[(X%D+D)%D].push_back(X);
}
long ans=0;
for(map<long,vector<long> >::iterator it=M.begin();it!=M.end();it++)
{
vector<long>tmp=it->second;
sort(tmp.begin(),tmp.end());
long pre=-2e18;
for(long x:tmp)
{
long L=x-D*T,R=x+D*T;
if(pre>=L)
{
ans-=(pre-L+D)/D;
}
ans+=2*T+1;
pre=R;
}
}
cout<<ans<<endl;
}