結果
| 問題 | No.3677 Global Checksum |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-08-10 05:48:36 |
| 言語 | Java (openjdk 26.0.2.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,438 bytes |
| 記録 | |
| コンパイル時間 | 3,423 ms |
| コンパイル使用メモリ | 83,048 KB |
| 実行使用メモリ | 129,992 KB |
| 最終ジャッジ日時 | 2026-09-04 22:14:30 |
| 合計ジャッジ時間 | 7,805 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 TLE * 6 |
ソースコード
import java.io.*;
public class Main {
private static final byte[] INPUT = new byte[40_000_032];
private static int position;
private static int nextInt() {
int c;
do c = INPUT[position++] & 255; while (c <= 32);
int value = 0;
while (c >= '0' && c <= '9') {
value = value * 10 + c - '0';
c = INPUT[position++] & 255;
}
return value;
}
private static int decimalLength(long value) {
if (value < 10L) return 1;
if (value < 100L) return 2;
if (value < 1_000L) return 3;
if (value < 10_000L) return 4;
if (value < 100_000L) return 5;
if (value < 1_000_000L) return 6;
if (value < 10_000_000L) return 7;
if (value < 100_000_000L) return 8;
if (value < 1_000_000_000L) return 9;
return 10;
}
private static int appendUnsigned(byte[] output, int start, int signedValue) {
long value = Integer.toUnsignedLong(signedValue);
int end = start + decimalLength(value);
int next = end + 1;
output[end] = '\n';
int p = end;
while (value >= 100) {
int pair = (int)(value % 100);
value /= 100;
output[--p] = (byte)('0' + pair % 10);
output[--p] = (byte)('0' + pair / 10);
}
if (value < 10) {
output[--p] = (byte)('0' + value);
} else {
output[--p] = (byte)('0' + value % 10);
output[--p] = (byte)('0' + value / 10);
}
return next;
}
public static void main(String[] args) throws Exception {
int inputLength = 0;
while (inputLength < INPUT.length) {
int count = System.in.read(INPUT, inputLength, INPUT.length - inputLength);
if (count < 0) break;
inputLength += count;
}
int h = nextInt();
int w = nextInt();
int[] rowSum = new int[h];
int total = 0;
for (int i = 0; i < h; ++i) {
int sum = 0;
for (int j = 0; j < w; ++j) sum += nextInt();
rowSum[i] = sum;
total += sum;
}
byte[] output = new byte[h * 11];
int outputPosition = 0;
for (int sum : rowSum) {
outputPosition = appendUnsigned(output, outputPosition, sum + total);
}
System.out.write(output, 0, outputPosition);
}
}