Submission #1520177
Source Code Expand
public class Main { public static void main(String[] args) throws java.io.IOException { // 弁当の種類 int N = 0; // 列車の本数 (M+1で駅の合計) int M = 0; java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); // 1行読み込み String strStdIn = in.readLine(); // 数値以外の部分で区切る String[] strs = strStdIn.split("[^0-9]"); // 弁当の種類取得 N = Integer.parseInt(strs[0]); // 列車の本数取得 M = Integer.parseInt(strs[1]); // 弁当販売リスト key:弁当の種類 value:弁当の販売区間 int[][] bentoList = new int[N][]; int index = 0; // 弁当販売リスト取得 strStdIn = in.readLine(); while (strStdIn != null && !strStdIn.equals("")) { String[] bentoSyurui = strStdIn.split("[^0-9]"); // 弁当販売開始位置 int start = Integer.parseInt(bentoSyurui[0]); // 弁当販売終端位置 int end = Integer.parseInt(bentoSyurui[1]); // 配列挿入 bentoList[index] = new int[] { start, end }; index++; strStdIn = in.readLine(); } // 列車本数分繰り返し for (int trainCount = 1; trainCount <= M; trainCount++) { // 弁当購入判定フラグリスト boolean[] kounyuBento = new boolean[N]; int bentoCount = 0; // 停車駅数分繰り返し for (int teisyaCount = trainCount; teisyaCount <= M; teisyaCount += trainCount) { // 弁当の種類分繰り返し for (int i = 0; i < bentoList.length; i++) { int[] bento = bentoList[i]; if (bento[0] <= teisyaCount && teisyaCount <= bento[1]) { if (kounyuBento[i] == false) { bentoCount++; kounyuBento[i] = true; } } } } // 列車ごとの弁当購入種類出力 System.out.println(bentoCount); } } }
Submission Info
Submission Time | |
---|---|
Task | E - Snuke Line |
User | KurataKcyb |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 2064 Byte |
Status | TLE |
Exec Time | 2112 ms |
Memory | 163704 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 68 ms | 18644 KB |
00_example_02.txt | AC | 68 ms | 21332 KB |
01.txt | AC | 69 ms | 17748 KB |
02.txt | AC | 133 ms | 20948 KB |
03.txt | AC | 98 ms | 19668 KB |
04.txt | AC | 74 ms | 19028 KB |
05.txt | AC | 101 ms | 16976 KB |
06.txt | AC | 115 ms | 16980 KB |
07.txt | AC | 69 ms | 19284 KB |
08.txt | AC | 110 ms | 20436 KB |
09.txt | AC | 102 ms | 24276 KB |
10.txt | AC | 73 ms | 17108 KB |
11.txt | TLE | 2107 ms | 157976 KB |
12.txt | TLE | 2107 ms | 157724 KB |
13.txt | TLE | 2107 ms | 157968 KB |
14.txt | TLE | 2111 ms | 155152 KB |
15.txt | TLE | 2112 ms | 160048 KB |
16.txt | TLE | 2107 ms | 156656 KB |
17.txt | TLE | 2106 ms | 157432 KB |
18.txt | TLE | 2110 ms | 157240 KB |
19.txt | TLE | 2110 ms | 159272 KB |
20.txt | TLE | 2106 ms | 157544 KB |
21.txt | TLE | 2110 ms | 159492 KB |
22.txt | TLE | 2110 ms | 158360 KB |
23.txt | TLE | 2110 ms | 158584 KB |
24.txt | TLE | 2110 ms | 163208 KB |
25.txt | TLE | 2110 ms | 156712 KB |
26.txt | TLE | 2110 ms | 158548 KB |
27.txt | TLE | 2106 ms | 159828 KB |
28.txt | TLE | 2110 ms | 159832 KB |
29.txt | TLE | 2110 ms | 161072 KB |
30.txt | TLE | 2110 ms | 159828 KB |
31.txt | TLE | 2110 ms | 157968 KB |
32.txt | TLE | 2110 ms | 161016 KB |
33.txt | TLE | 2107 ms | 161776 KB |
34.txt | TLE | 2109 ms | 163704 KB |
35.txt | TLE | 2106 ms | 159472 KB |
36.txt | AC | 69 ms | 21204 KB |
37.txt | AC | 559 ms | 36140 KB |