Submission #2555947
Source Code Expand
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; /** * * @author nai */ public class Main { public static void main(String[] args) { StringBuilder sb = new StringBuilder(); FastScanner sc = new FastScanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int ans = Math.min(D, B) - Math.max(A, C); if(ans < 0) ans = 0; System.out.println(ans); } static class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public FastScanner(InputStream in) { reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } public String next() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } /*public String nextChar(){ return (char)next()[0]; }*/ public String nextLine() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken("\n"); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } public double nextDouble() { return Double.parseDouble(next()); } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public char[] nextCharArray(int n){ char[] a = next().toCharArray(); return a; } public char[][] nextCharArray2(int h , int w){ char[][] a = new char[h][w]; for (int i = 0; i < h; i++) { a[i] = next().toCharArray(); } return a; } public char[][] nextWrapCharArray2(int h , int w){ char[][] a = new char[h + 2][w + 2]; for (int i = 1; i < h + 1; i++) { a[i] = (" " + next() + " ").toCharArray(); } return a; } public int [][] nextIntArray2(int h, int w){ int[][] a = new int[h][w]; for(int hi = 0 ; hi < h ; hi++){ for(int wi = 0 ; wi < h ; wi++){ a[h][w] = nextInt(); } } return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = nextLong(); } return a; } public long [][] nextLongArray2(int h, int w){ long[][] a = new long[h][w]; for(int hi = 0 ; hi < h ; hi++){ for(int wi = 0 ; wi < h ; wi++){ a[h][w] = nextLong(); } } return a; } } }
Submission Info
Submission Time | |
---|---|
Task | B - Two Switches |
User | baito |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 3894 Byte |
Status | AC |
Exec Time | 71 ms |
Memory | 21204 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 71 ms | 19284 KB |
sample_02.txt | AC | 69 ms | 20436 KB |
sample_03.txt | AC | 70 ms | 18260 KB |
subtask_1_1.txt | AC | 70 ms | 21076 KB |
subtask_1_2.txt | AC | 70 ms | 18772 KB |
subtask_1_3.txt | AC | 68 ms | 18644 KB |
subtask_1_4.txt | AC | 70 ms | 20564 KB |
subtask_1_5.txt | AC | 69 ms | 21204 KB |
subtask_1_6.txt | AC | 68 ms | 19028 KB |
subtask_1_7.txt | AC | 68 ms | 19156 KB |
subtask_1_8.txt | AC | 70 ms | 20564 KB |
subtask_1_9.txt | AC | 70 ms | 20308 KB |