Submission #615908
Source Code Expand
import java.io.*; import java.util.*; public class Main{ public void solve(){ int N = nextInt(); int prev = 1000000000; for(int i = 1; i < N; i++){ int tmp = nextInt(); out.print(Math.min(prev, tmp)); out.print(" "); prev = tmp; } out.println(prev); } private static PrintWriter out; public static void main(String[] args){ out = new PrintWriter(System.out); new Main().solve(); out.flush(); } public static int nextInt(){ int num = 0; String str = next(); boolean minus = false; int i = 0; if(str.charAt(0) == '-'){ minus = true; i++; } int len = str.length(); for(;i < len; i++){ char c = str.charAt(i); if(!('0' <= c && c <= '9')) throw new RuntimeException(); num = num * 10 + (c - '0'); } return minus ? -num : num; } public static long nextLong(){ long num = 0; String str = next(); boolean minus = false; int i = 0; if(str.charAt(0) == '-'){ minus = true; i++; } int len = str.length(); for(;i < len; i++){ char c = str.charAt(i); if(!('0' <= c && c <= '9')) throw new RuntimeException(); num = num * 10l + (c - '0'); } return minus ? -num : num; } public static String next(){ int c; while(!isAlNum(c = read())){} StringBuilder build = new StringBuilder(); build.append((char)c); while(isAlNum(c = read())){ build.append((char)c); } return build.toString(); } private static byte[] inputBuffer = new byte[1024]; private static int bufferLength = 0; private static int bufferIndex = 0; private static int read(){ if(bufferLength < 0) throw new RuntimeException(); if(bufferIndex >= bufferLength){ try{ bufferLength = System.in.read(inputBuffer); bufferIndex = 0; }catch(IOException e){ throw new RuntimeException(e); } if(bufferLength <= 0) return (bufferLength = -1); } return inputBuffer[bufferIndex++]; } private static boolean isAlNum(int c){ return '!' <= c && c <= '~'; } }
Submission Info
Submission Time | |
---|---|
Task | B - 積み鉛筆 |
User | a3636tako |
Language | Java (OpenJDK 1.7.0) |
Score | 80 |
Code Size | 2066 Byte |
Status | AC |
Exec Time | 602 ms |
Memory | 34400 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 80 / 80 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample1.txt | AC | 448 ms | 22356 KB |
sample2.txt | AC | 302 ms | 22368 KB |
sample3.txt | AC | 302 ms | 22412 KB |
subtask0_0.txt | AC | 499 ms | 34304 KB |
subtask0_1.txt | AC | 510 ms | 33616 KB |
subtask0_10.txt | AC | 499 ms | 33996 KB |
subtask0_11.txt | AC | 507 ms | 34072 KB |
subtask0_12.txt | AC | 602 ms | 33856 KB |
subtask0_13.txt | AC | 493 ms | 34008 KB |
subtask0_14.txt | AC | 514 ms | 34360 KB |
subtask0_2.txt | AC | 489 ms | 34100 KB |
subtask0_3.txt | AC | 498 ms | 34312 KB |
subtask0_4.txt | AC | 500 ms | 34048 KB |
subtask0_5.txt | AC | 491 ms | 33584 KB |
subtask0_6.txt | AC | 500 ms | 34200 KB |
subtask0_7.txt | AC | 493 ms | 33984 KB |
subtask0_8.txt | AC | 511 ms | 34400 KB |
subtask0_9.txt | AC | 512 ms | 34396 KB |