結果
| 問題 | No.33 アメーバがたくさん |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-11-19 23:49:36 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 1,044 bytes |
| 記録 | |
| コンパイル時間 | 504 ms |
| コンパイル使用メモリ | 66,428 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-11 15:47:44 |
| 合計ジャッジ時間 | 1,115 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <cstdio>
#include <vector>
#include <algorithm>
typedef long long ll;
typedef std::pair<ll,ll> P;
int N;
ll D, T;
ll xs[100];
bool used[100];
int main(){
scanf("%d %lld %lld", &N, &D, &T);
for(int i=0;i<N;i++){scanf("%lld", &xs[i]);}
std::sort(xs, xs+N);
ll res = 0ll;
for(int i=0;i<N;i++){
if(used[i]){continue;}
used[i] = true;
ll xi = xs[i];
std::vector<P> ps;
for(int j=i;j<N;j++){
if((xs[j] - xi) % D == 0){
int mid = (xs[j]-xi) / D;
ps.push_back(std::make_pair(mid-T, mid+T));
used[j] = true;
}
}
int size = ps.size();
for(int i=0,j=0;i<size;){
P p = ps[i];
while(j < size && ps[j].first <= p.second){
p.second = ps[j].second;
j += 1;
}
res += p.second - p.first + 1;
i = j;
}
}
printf("%lld\n", res);
}
tottoripaper