Submission #574128


Source Code Expand

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;

public class Main{
	public static void main(String[] args){
		try {
			(new Solve()).solve();
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
}

class Solve{
	String[] deg = {"NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"};
	int[] dis = {2,15,33,54,79,107,138,171,207,244,284,326};
	
	void solve() throws NumberFormatException, IOException{
		final ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		List<int[]> list = new ArrayList<>();
		int[] bf = {0,0};
		int[][] input = new int[n][2];
		for(int i=0; i<n; i++){
			String[] line = in.readLine().split("-");
			input[i][0] = Integer.parseInt(line[0]);
			input[i][1] = Integer.parseInt(line[1]);
		}
		Arrays.sort(input, new Comparator<int[]>() {
			@Override
			public int compare(int[] o1, int[] o2) {
				return o1[0]-o2[0];
			}
		});
		for(int i=0; i<n; i++){
			int s = input[i][0];
			int t = input[i][1];
			if(s%10<5) s = (s/10)*10;
			else s = (s/10)*10+5;
			if(t%10!=0&&t%10<=5) t = (t/10)*10+5;
			else if(t%10!=0) t = (t/10)*10+10;
			if(t%100/10>=6){
				t += 100;
				t -= 60;
			}
			if(i==0){
				bf[0] = s;
				bf[1] = t;
				list.add(bf);
				continue;
			}
			if(s<=bf[1]){
				if(bf[1]<t) bf[1] = t;
				continue;
			}
			bf = new int[2];
			bf[0] = s;
			bf[1] = t;
			list.add(bf);
		}
		for(int[] t: list){
			System.out.format("%04d-%04d\n",t[0],t[1]);
		}
	}
}

class MultiSet<T> extends HashMap<T, Integer>{
	@Override
	public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
}
 
class ContestWriter{
	private PrintWriter out;
	public ContestWriter(String filename) throws IOException
	{out = new PrintWriter(new BufferedWriter(new FileWriter(filename)));}
	public ContestWriter() throws IOException{out = new PrintWriter(System.out);}
	public void println(String str){out.println(str);}
	public void print(String str){out.print(str);}
	public void close(){out.close();}
}
 
class ContestScanner {
	private BufferedReader reader;private String[]line;private int idx;
	public ContestScanner()throws FileNotFoundException 
	{reader=new BufferedReader(new InputStreamReader(System.in));}
	public ContestScanner(String filename)throws FileNotFoundException
	{reader=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
	public String nextToken()throws IOException{if(line==null||line.length<=idx){
	line=reader.readLine().trim().split(" ");idx=0;}return line[idx++];}
	public String readLine()throws IOException{return reader.readLine();}
	public long nextLong()throws IOException,NumberFormatException{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User threepipes_s
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 3428 Byte
Status AC
Exec Time 766 ms
Memory 36224 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 48
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 760 ms 21384 KB
00_sample_02.txt AC 320 ms 21296 KB
00_sample_03.txt AC 350 ms 21384 KB
cho_cho_chokudai.txt AC 683 ms 33800 KB
chokudai_ga_cho.txt AC 644 ms 34116 KB
test_01.txt AC 377 ms 22376 KB
test_02.txt AC 385 ms 22424 KB
test_03.txt AC 382 ms 22352 KB
test_04.txt AC 384 ms 22444 KB
test_05.txt AC 384 ms 22412 KB
test_06.txt AC 328 ms 21404 KB
test_07.txt AC 342 ms 21436 KB
test_08.txt AC 339 ms 21424 KB
test_09.txt AC 369 ms 22428 KB
test_10.txt AC 362 ms 22444 KB
test_11.txt AC 344 ms 22204 KB
test_12.txt AC 343 ms 22200 KB
test_13.txt AC 343 ms 21380 KB
test_14.txt AC 351 ms 22232 KB
test_15.txt AC 359 ms 22388 KB
test_16.txt AC 328 ms 21296 KB
test_17.txt AC 343 ms 22296 KB
test_18.txt AC 327 ms 21388 KB
test_19.txt AC 340 ms 22248 KB
test_20.txt AC 338 ms 22264 KB
test_21.txt AC 666 ms 36060 KB
test_22.txt AC 673 ms 35484 KB
test_23.txt AC 705 ms 35780 KB
test_24.txt AC 689 ms 35996 KB
test_25.txt AC 692 ms 35128 KB
test_26.txt AC 669 ms 36224 KB
test_27.txt AC 606 ms 33392 KB
test_28.txt AC 692 ms 35320 KB
test_29.txt AC 336 ms 21260 KB
test_30.txt AC 341 ms 21352 KB
test_31.txt AC 508 ms 29000 KB
test_32.txt AC 328 ms 21348 KB
test_33.txt AC 652 ms 35820 KB
test_34.txt AC 324 ms 21352 KB
test_35.txt AC 357 ms 21488 KB
test_36.txt AC 766 ms 35412 KB
test_37.txt AC 681 ms 35408 KB
test_38.txt AC 673 ms 35256 KB
test_39.txt AC 700 ms 34904 KB
test_40.txt AC 689 ms 35616 KB
test_41.txt AC 598 ms 33880 KB
test_42.txt AC 751 ms 34828 KB
test_43.txt AC 594 ms 34232 KB