結果
| 問題 | No.3677 Global Checksum |
| コンテスト | |
| ユーザー |
harurun
|
| 提出日時 | 2026-09-03 16:04:47 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,753 bytes |
| 記録 | |
| コンパイル時間 | 2,408 ms |
| コンパイル使用メモリ | 354,884 KB |
| 実行使用メモリ | 44,404 KB |
| 最終ジャッジ日時 | 2026-09-04 23:12:13 |
| 合計ジャッジ時間 | 10,199 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 20 |
ソースコード
/*
#include "testlib.h"
int main(int argc, char* argv[]){
registerValidation(argc, argv);
int H = inf.readInt(1,1'000'000);
inf.readSpace();
int W = inf.readInt(1, 4'000'000);
ensuref((long long)H * (long long)W <= 4'000'000, "HxW violation");
inf.readEoln();
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
if(j > 0){
inf.readSpace();
}
int A = inf.readInt(0, 1'000'000'000);
}
inf.readEoln();
}
inf.readEof();
}
*/
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
namespace Validator {
constexpr size_t MAX_INPUT_SIZE = 64ULL << 20; // 64 MiB
static char buf[MAX_INPUT_SIZE + 1];
static char* p;
static char* ed;
[[noreturn]]
inline void fail(const char* msg) {
fprintf(stderr, "validation failed: %s\n", msg);
_exit(1);
}
inline void init() {
size_t n = 0;
while (n <= MAX_INPUT_SIZE) {
ssize_t r = read(
STDIN_FILENO,
buf + n,
MAX_INPUT_SIZE + 1 - n
);
if (r < 0) fail("read error");
if (r == 0) break;
n += (size_t)r;
if (n > MAX_INPUT_SIZE) {
fail("input too large");
}
}
p = buf;
ed = buf + n;
}
inline int readInt(int lo, int hi) {
if (p == ed || *p < '0' || *p > '9') {
fail("integer expected");
}
unsigned int x = 0;
do {
x = x * 10 + (*p - '0');
++p;
if (x > (unsigned int)hi) {
fail("integer out of range");
}
} while (p != ed && '0' <= *p && *p <= '9');
if (x < (unsigned int)lo) {
fail("integer out of range");
}
return (int)x;
}
inline void readSpace() {
if (p == ed || *p != ' ') {
fail("space expected");
}
++p;
}
inline void readEoln() {
if (p == ed) {
fail("end of line expected");
}
if (*p == '\n') {
++p;
return;
}
if (*p == '\r') {
++p;
if (p == ed || *p != '\n') {
fail("end of line expected");
}
++p;
return;
}
fail("end of line expected");
}
inline void readEof() {
if (p != ed) {
fail("EOF expected");
}
}
} // namespace Validator
int main() {
using namespace Validator;
init();
int H = readInt(1, 1'000'000);
readSpace();
int W = readInt(1, 4'000'000);
if ((long long)H * W > 4'000'000) {
fail("HxW violation");
}
readEoln();
for (int i = 0; i < H; ++i) {
readInt(0, 1'000'000'000);
for (int j = 1; j < W; ++j) {
readSpace();
readInt(0, 1'000'000'000);
}
readEoln();
}
readEof();
}
harurun