Submission #171806
Source Code Expand
Copy
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.math.*; import java.io.*; import java.text.*; import java.util.*; public class Main { // private static final String INPUT_PATH = "C:\\atcoder\\b_008_004.txt"; private static final String INPUT_PATH = null; public void solve() { try { br = new BufferedReader(new InputStreamReader( INPUT_PATH == null ? System.in : new FileInputStream(new File(INPUT_PATH)))); int R = readBufInt(); int C = readBufInt(); int D = readBufInt(); int[][] takos = new int[R][C]; for (int i = 0; i < R; i++) { takos[i] = readIntArray(); } int max = 0; boolean isG = D % 2 == 0; if (isG && D >= 2) { max = takos[0][0]; } int def = isG ? 2 : 1; for (int i = def; i <= D ; i += 2) { for (int j = i ; j > 0; j --) { int h = i - j; if (h >= R) { break; } if (j >= C) { continue; } max = max(max, takos[h][j]); } } pw.println(max); } catch(Exception e) { e.printStackTrace(); } finally { try { br.close(); } catch (Exception igunore) {} } } boolean deepEquals(int[] i1, int[] i2) { if (i1.length != i2.length) return false; for (int i = 0 ; i < i1.length; i++) if (i1[i] != i2[i]) return false; return true; } String getKey(int[] i) { StringBuilder sb = new StringBuilder(); for (int s : i) sb.append(" " + s); return sb.toString(); } private int brPos = 0; private int[] brBuf = null; private int readBufInt() throws IOException { if (brBuf == null || brBuf.length == brPos) { brBuf = readIntArray(); brPos = 0; } return brBuf[brPos++]; } private int readInt() throws IOException { return Integer.parseInt(br.readLine()); } private long readLong() throws IOException { return Long.parseLong(br.readLine()); } private int[] readIntArray() throws IOException { String[] s = readStrArray(); int cnt = s.length; int[] out = new int[cnt]; for (int i = 0; i < cnt; i++) out[i] = Integer.parseInt(s[i]); return out; } private Integer[] convIntArray(int[] arg) { int len = arg.length; Integer[] res = new Integer[len]; for (int i = 0; i < len; i++) res[i] = arg[i]; return res; } private long[] readLongArray() throws IOException { String[] s = readStrArray(); int cnt = s.length; long[] out = new long[cnt]; for (int i = 0; i < cnt; i++) out[i] = Long.parseLong(s[i]); return out; } private String[] readStrArray() throws IOException { String[] s = br.readLine().split(" "); return s; } void permutationAll(int[] p) { permutation(p, 0, p.length - 1); } void permutationRange(int from, int to) { int cnt = to - from + 1; int[] elements = new int[cnt]; for (int i = 0 ; i < cnt; i++) elements[i] = from++; permutation(elements, 0, cnt - 1); } void permutationString(String element) { char[] elements = element.toCharArray(); permutationString(elements, 0, elements.length - 1); } void permutation(int[] elements, int nowCnt, int totalCnt) { if (nowCnt == totalCnt) { // TODO insertCode } else { for (int i = nowCnt; i <= totalCnt; i++) { int tmp = elements[nowCnt]; elements[nowCnt] = elements[i]; elements[i] = tmp; permutation(elements, nowCnt+1, totalCnt); tmp = elements[nowCnt]; elements[nowCnt] = elements[i]; elements[i] = tmp; } } } void permutationString(char[] elements, int nowCnt, int totalCnt) { if (nowCnt == totalCnt) { // TODO insertCode } else { for (int i = nowCnt; i <= totalCnt; i++) { char tmp = elements[nowCnt]; elements[nowCnt] = elements[i]; elements[i] = tmp; permutationString(elements, nowCnt+1, totalCnt); tmp = elements[nowCnt]; elements[nowCnt] = elements[i]; elements[i] = tmp; } } } private static long gcd(long n1, long n2) { return (n2 == 0)?n1:gcd(n2, n1%n2); } private static int gcd(int n1, int n2) { return (n2 == 0)?n1:gcd(n2, n1%n2); } public static void main(String[] args) { long from = System.currentTimeMillis(); Main app = new Main(); app.solve(); pw.flush(); pw.println(System.currentTimeMillis() - from); } void printMatrix(int[][] p) { for (int[] i : p) printArray(i); } void printArray(int[] p) { for (int i : p) System.out.print(i + " "); System.out.println(); } void debug(Object ... o) { pw.write(deepToString(o)); } BufferedReader br = null; static PrintWriter pw = new PrintWriter(System.out); class Type { int x, y; Type (int x, int y) { this.x = x; this.y = y; } } }
Submission Info
Submission Time | |
---|---|
Task | B - 謎の人物X |
User | tochukaso |
Language | Java (OpenJDK 1.7.0) |
Score | 60 |
Code Size | 6046 Byte |
Status | WA |
Exec Time | 1069 ms |
Memory | 37764 KB |
Judge Result
Set Name | Sample | Subtask1 | Subtask2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 60 / 60 | 0 / 40 | ||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
Subtask1 | sample_01.txt, sample_02.txt, sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt |
Subtask2 | subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1069 ms | 17784 KB |
sample_02.txt | AC | 385 ms | 17592 KB |
sample_03.txt | AC | 369 ms | 17684 KB |
subtask1_01.txt | AC | 371 ms | 17688 KB |
subtask1_02.txt | AC | 362 ms | 17736 KB |
subtask1_03.txt | AC | 356 ms | 17736 KB |
subtask1_04.txt | AC | 428 ms | 21136 KB |
subtask1_05.txt | AC | 400 ms | 17744 KB |
subtask1_06.txt | AC | 402 ms | 19792 KB |
subtask1_07.txt | AC | 416 ms | 21580 KB |
subtask1_08.txt | AC | 451 ms | 21448 KB |
subtask1_09.txt | AC | 455 ms | 21784 KB |
subtask1_10.txt | AC | 461 ms | 21740 KB |
subtask1_11.txt | AC | 451 ms | 21800 KB |
subtask1_12.txt | AC | 436 ms | 21376 KB |
subtask1_13.txt | AC | 441 ms | 21780 KB |
subtask1_14.txt | AC | 429 ms | 21400 KB |
subtask1_15.txt | AC | 451 ms | 21956 KB |
subtask2_01.txt | AC | 378 ms | 18452 KB |
subtask2_02.txt | WA | 381 ms | 19140 KB |
subtask2_03.txt | AC | 558 ms | 31336 KB |
subtask2_04.txt | AC | 418 ms | 21340 KB |
subtask2_05.txt | AC | 459 ms | 24580 KB |
subtask2_06.txt | AC | 534 ms | 30264 KB |
subtask2_07.txt | AC | 646 ms | 37412 KB |
subtask2_08.txt | AC | 731 ms | 37512 KB |
subtask2_09.txt | AC | 750 ms | 37408 KB |
subtask2_10.txt | AC | 686 ms | 37616 KB |
subtask2_11.txt | AC | 709 ms | 37764 KB |
subtask2_12.txt | WA | 733 ms | 36900 KB |
subtask2_13.txt | AC | 720 ms | 37552 KB |
subtask2_14.txt | AC | 676 ms | 37084 KB |
subtask2_15.txt | AC | 713 ms | 37420 KB |