結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-10-03 19:08:14 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,032 bytes |
| コンパイル時間 | 2,557 ms |
| コンパイル使用メモリ | 79,144 KB |
| 実行使用メモリ | 54,440 KB |
| 最終ジャッジ日時 | 2024-09-24 09:53:17 |
| 合計ジャッジ時間 | 4,739 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 3 |
ソースコード
//package yukicoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
/**
* yukicoder no.33
* @author scache
*
*/
public class Main {
public static void main(String[] args) {
Main p = new Main();
}
public Main() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long d = sc.nextLong();
long t = sc.nextLong();
long[] x = new long[n];
for(int i=0;i<n;i++)
x[i] = sc.nextLong()+1000000000;
System.out.println(solve(d, t, x));
}
public long solve(long d, long t, long[] x) {
Arrays.sort(x);
boolean[] isDone = new boolean[x.length];
long res = 0;
for(int i=0;i<x.length;i++){
if(isDone[i])
continue;
isDone[i] = true;
long r = x[i]%d;
ArrayList<Long> seq = new ArrayList<Long>() ;
seq.add(x[i]);
for(int j=i+1;j<x.length;j++){
if(x[j]%d==r && x[j]-x[i]<=2*d*t){
seq.add(x[j]);
isDone[j] = true;
}
}
res += (seq.get(seq.size()-1)+d*t - (seq.get(0)-d*t))/d + 1;
}
return res;
}
}