結果
| 問題 | No.59 鉄道の旅 |
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2017-01-21 20:57:33 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 741 bytes |
| 記録 | |
| コンパイル時間 | 2,425 ms |
| コンパイル使用メモリ | 81,488 KB |
| 実行使用メモリ | 69,904 KB |
| 最終ジャッジ日時 | 2026-05-31 08:15:55 |
| 合計ジャッジ時間 | 11,567 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 11 |
ソースコード
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){
int tmp=0;
for(int j=W; j<1000001; j++){
tmp+=c[j];
}
if(tmp<K){
c[W]++;
}
}else{
W*=-1;
if(c[W]>0)c[W]--;
}
}
int ans=0;
for(int j=0; j<1000001; j++){
ans+=c[j];
}
System.out.println(ans);
}
}
kohaku_kohaku