結果

問題 No.3677 Global Checksum
コンテスト
ユーザー めーらく
提出日時 2026-09-04 23:12:30
言語 C++23
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 1,573 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,028 ms
コンパイル使用メモリ 171,744 KB
実行使用メモリ 9,724 KB
最終ジャッジ日時 2026-09-04 23:12:53
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//https://qiita.com/nojima/items/57b9d39d7d73362ac883を丸パクリ
# include <cctype>
# include <cstdio>
# include <cstring>
# include <iostream>
# include <stdexcept>
# include <vector>
# include <unistd.h>
using namespace std;
class Scanner {
    vector<char> buffer;
    ssize_t n_written;
    ssize_t n_read;

public:
    Scanner(): buffer(1024*1024) { do_read(); }

    long long read_int() {
        long long ret = 0, sgn = 1;
        int ch = current_char();
        while (isspace(ch)) { ch = next_char(); }
        if (ch == '-') { sgn = -1; ch = next_char(); }
        for (; isdigit(ch); ch = next_char())
            ret = (ret * 10) + (ch - '0');
        return sgn * ret;
    }

private:
    void do_read() {
        ssize_t r = read(0, &buffer[0], buffer.size());
        if (r < 0) {
            throw runtime_error(strerror(errno));
        }
        n_written = r;
        n_read = 0;
    }

    inline int next_char() {
        ++n_read;
        if (n_read == n_written) { do_read(); }
        return current_char();
    }

    inline int current_char() {
        return (n_read == n_written) ? EOF : buffer[n_read];
    }
};

int main() {
    Scanner scanner;
    int h = scanner.read_int();
    int w = scanner.read_int();
    unsigned int sum = 0;
    vector<unsigned int> hs(h);
    for (int i = 0; i < h; ++i) {
        long long here=0;
        for (int j = 0; j < w; ++j) {
            hs[i] += scanner.read_int();
        }
        sum+=hs[i];
    }
    string ans;
    for(int i=0;i<h;i++) ans+=to_string((hs[i]+sum))+'\n';
    cout << ans;
}
0