結果
| 問題 |
No.1056 2D Lamps
|
| コンテスト | |
| ユーザー |
noshi91
|
| 提出日時 | 2019-11-15 23:49:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,209 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 67,584 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 11:01:33 |
| 合計ジャッジ時間 | 5,328 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 14 |
ソースコード
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <limits>
namespace checker {
std::string c_to_str(const int c) {
if (c == '\n') {
return "'\n'";
}
if (c == std::char_traits<char>::eof()) {
return "eof";
}
return std::string({'\'', char(c), '\''});
}
int scan_char() { return std::cin.get(); }
bool is_digit(const int c) { return '0' <= c && c <= '9'; }
int to_num(const int c) { return c - '0'; }
std::intmax_t scan_imax(const int end) {
if (is_digit(end)) {
std::cerr << "end must not be digit" << std::endl;
std::abort();
}
std::intmax_t ret = 0;
bool negative = false;
int c = scan_char();
if (c == '-') {
negative = true;
c = scan_char();
}
if (!is_digit(c)) {
std::cerr << "no digits" << std::endl;
std::abort();
}
if (c == '0') {
if (negative) {
std::cerr << "found -0" << std::endl;
std::abort();
}
c = scan_char();
if (is_digit(c)) {
std::cerr << "leading zeros" << std::endl;
std::abort();
}
if (c != end) {
std::cerr << "expected " << c_to_str(end) << ", found " << c_to_str(c)
<< std::endl;
std::abort();
}
return 0;
}
while (is_digit(c)) {
c = to_num(c);
if (ret > (std::numeric_limits<std::intmax_t>::max() - c) / 10) {
std::cerr << "overflow" << std::endl;
std::abort();
}
ret = ret * 10 + c;
c = scan_char();
};
if (c != end) {
std::cerr << "expected " << c_to_str(end) << ", found " << c_to_str(c)
<< std::endl;
std::abort();
}
if (negative) {
ret = -ret;
}
return ret;
}
void check() {
int n = scan_imax(' ');
assert(1 <= n && n <= 200);
int m = scan_imax('\n');
assert(2 <= m && m <= 200);
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
for (int k = 0; k < n; ++k) {
int a = scan_char();
assert(a == '.' || a == '#');
}
assert(scan_char() == '\n');
}
if (i + 1 < m) {
assert(scan_char() == '\n');
} else {
assert(scan_char() == std::char_traits<char>::eof());
}
}
}
} // namespace checker
int main() {
checker::check();
return 0;
}
noshi91