結果
| 問題 |
No.59 鉄道の旅
|
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2016-12-10 05:38:08 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 699 bytes |
| コンパイル時間 | 2,438 ms |
| コンパイル使用メモリ | 77,892 KB |
| 実行使用メモリ | 94,844 KB |
| 最終ジャッジ日時 | 2024-12-25 00:45:05 |
| 合計ジャッジ時間 | 36,146 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 RE * 1 TLE * 4 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int [] c = new int [1000001];
for(int i=0; i<N; i++){
int W = sc.nextInt();
if(W>0){
if(c[W]<K){
for(int j=W; j>=0; j--){
c[j]++;
}
}
}else{
if(c[1-W]-c[-W]<0){
for(int j=-W; j>=0; j--){
c[j]--;
}
}
}
}
System.out.println(c[0]);
}
}
kohaku_kohaku