結果
問題 | No.607 開通777年記念 |
ユーザー | takeya_okino |
提出日時 | 2019-08-12 11:55:45 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,017 bytes |
コンパイル時間 | 3,431 ms |
コンパイル使用メモリ | 74,280 KB |
実行使用メモリ | 73,604 KB |
最終ジャッジ日時 | 2023-10-13 11:59:18 |
合計ジャッジ時間 | 10,382 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 122 ms
55,928 KB |
testcase_02 | RE | - |
testcase_03 | AC | 122 ms
55,960 KB |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 123 ms
56,200 KB |
testcase_07 | AC | 661 ms
68,156 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[][] a = new int[m][n]; int[][] b = new int[m][n]; for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { a[i][j] = sc.nextInt(); } } for(int j = 0; j < n; j++) { b[0][j] = a[0][j]; } for(int i = 1; i < m; i++) { for(int j = 0; j < n; j++) { b[i][j] = b[i - 1][j] + a[i][j]; } } String ans = "NO"; int p = 0; for(int i = 0; i < m; i++) { int left = 0; int right = 0; int sum = 0; while(right < n) { sum += b[i][right]; if(sum <= 777) { if(sum == 777) { p++; right++; } else { right++; } } else { sum -= b[i][left]; left++; } } } if(p > 0) ans = "YES"; System.out.println(ans); } }