結果
| 問題 | No.3677 Global Checksum |
| コンテスト | |
| ユーザー |
harurun
|
| 提出日時 | 2026-09-03 16:02:36 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,788 bytes |
| 記録 | |
| コンパイル時間 | 2,681 ms |
| コンパイル使用メモリ | 355,316 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-09-04 23:12:02 |
| 合計ジャッジ時間 | 5,894 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_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>
using namespace std;
class FastValidator {
private:
static constexpr size_t BUFSIZE = 1 << 20;
char buf[BUFSIZE];
size_t pos = 0;
size_t len = 0;
[[noreturn]] void fail(const char* message) {
fprintf(stderr, "validation failed: %s\n", message);
exit(1);
}
char peekChar() {
if (pos == len) {
len = fread(buf, 1, BUFSIZE, stdin);
pos = 0;
if (len == 0) return '\0';
}
return buf[pos];
}
char readChar() {
char c = peekChar();
if (c != '\0') ++pos;
return c;
}
public:
long long readInt(long long l, long long r) {
char c = peekChar();
if (c < '0' || c > '9') {
fail("integer expected");
}
long long x = 0;
while (true) {
c = peekChar();
if (c < '0' || c > '9') break;
int d = readChar() - '0';
if (x > (LLONG_MAX - d) / 10) {
fail("integer overflow");
}
x = x * 10 + d;
}
if (x < l || x > r) {
fail("integer out of range");
}
return x;
}
void readSpace() {
if (readChar() != ' ') {
fail("space expected");
}
}
void readEoln() {
char c = readChar();
if (c == '\n') return;
if (c == '\r') {
if (readChar() == '\n') return;
}
fail("end of line expected");
}
void readEof() {
if (peekChar() != '\0') {
fail("EOF expected");
}
}
[[noreturn]] void ensureFail(const char* message) {
fail(message);
}
};
int main() {
FastValidator inf;
int H = inf.readInt(1, 1'000'000);
inf.readSpace();
int W = inf.readInt(1, 4'000'000);
if ((long long)H * W > 4'000'000) {
inf.ensureFail("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);
(void)A;
}
inf.readEoln();
}
inf.readEof();
}
harurun