Submission #432517
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.Comparator; import java.util.HashSet; import java.util.List; class Solve{ ContestScanner in; Solve() throws FileNotFoundException{ in = new ContestScanner(); } void solve() throws IOException{ int n = in.nextInt(); int a = in.nextInt(); int b = in.nextInt(); int p = 0; for(int i=0; i<n; i++){ String s = in.nextToken(); int d = in.nextInt(); if(d<a) d = a; else if(d > b) d = b; if(s.equals("West")) d = -d; p += d; } String res = "East"; if(p < 0){ res = "West"; p = -p; } else if(p == 0){ System.out.println(0); return; } System.out.println(res+" "+p); } } public class Main { static HashSet<String> set = new HashSet<String>(); public static void main(String[] args) throws NumberFormatException, IOException { Solve solve = new Solve(); solve.solve(); } } class Timer{ long time; public void set(){ time = System.currentTimeMillis(); } public long stop(){ return System.currentTimeMillis()-time; } } class Node{ int id; ArrayList<Node> edge = new ArrayList<Node>(); public Node(int id) { this.id = id; } public void createEdge(Node node) { edge.add(node); } } class MyComp implements Comparator<int[]> { final int idx; public MyComp(int idx){ this.idx = idx; } public int compare(int[] a, int[] b) { return a[idx] - b[idx]; } } class Reverse implements Comparator<Integer> { public int compare(Integer arg0, Integer arg1) { return arg1 - arg0; } } 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 println(Object obj) { out.println(obj); } public void print(String str) { out.print(str); } public void print(Object obj) { out.print(obj); } 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 | B - 双子とスイカ割り |
User | threepipes_s |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 3445 Byte |
Status | AC |
Exec Time | 576 ms |
Memory | 22648 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | 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, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample-01.txt | AC | 414 ms | 22560 KB |
sample-02.txt | AC | 417 ms | 22552 KB |
sample-03.txt | AC | 413 ms | 22552 KB |
test-01.txt | AC | 404 ms | 22504 KB |
test-02.txt | AC | 399 ms | 22428 KB |
test-03.txt | AC | 407 ms | 22488 KB |
test-04.txt | AC | 404 ms | 22516 KB |
test-05.txt | AC | 407 ms | 22532 KB |
test-06.txt | AC | 550 ms | 22584 KB |
test-07.txt | AC | 457 ms | 22484 KB |
test-08.txt | AC | 408 ms | 22460 KB |
test-09.txt | AC | 576 ms | 22484 KB |
test-10.txt | AC | 565 ms | 22512 KB |
test-11.txt | AC | 432 ms | 22604 KB |
test-12.txt | AC | 398 ms | 22564 KB |
test-13.txt | AC | 403 ms | 22608 KB |
test-14.txt | AC | 413 ms | 22556 KB |
test-15.txt | AC | 410 ms | 22644 KB |
test-16.txt | AC | 410 ms | 22600 KB |
test-17.txt | AC | 412 ms | 22584 KB |
test-18.txt | AC | 411 ms | 22648 KB |
test-19.txt | AC | 445 ms | 22624 KB |
test-20.txt | AC | 417 ms | 22544 KB |
test-21.txt | AC | 422 ms | 22616 KB |
test-22.txt | AC | 415 ms | 22480 KB |
test-23.txt | AC | 417 ms | 22540 KB |
test-24.txt | AC | 406 ms | 22548 KB |
test-25.txt | AC | 405 ms | 22604 KB |
test-26.txt | AC | 409 ms | 22464 KB |
test-27.txt | AC | 402 ms | 22524 KB |
test-28.txt | AC | 400 ms | 22636 KB |
test-29.txt | AC | 399 ms | 22532 KB |
test-30.txt | AC | 404 ms | 22600 KB |