結果

問題 No.3677 Global Checksum
コンテスト
ユーザー titan23
提出日時 2026-09-04 23:10:13
言語 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
結果
WA  
実行時間 -
コード長 3,513 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,111 ms
コンパイル使用メモリ 377,224 KB
実行使用メモリ 9,768 KB
最終ジャッジ日時 2026-09-04 23:10:56
合計ジャッジ時間 7,851 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 5 WA * 7 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #include <atcoder/all>
// using mint = atcoder::modint998244353;

using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)

// const ll dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
// const ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const ll dy[] = {-1, 0, 0, 1};
const ll dx[] = {0, -1, 1, 0};

template <class T, class T1, class T2> bool isrange(T target, T1 low, T2 high) { return low <= target && target < high; }
template <class T, class U> T min(const T &t, const U &u) { return t < u ? t : u; }
template <class T, class U> T max(const T &t, const U &u) { return t < u ? u : t; }
template <class T, class U> bool chmin(T &t, const U &u) { if (t > u) { t = u; return true; } return false; }
template <class T, class U> bool chmax(T &t, const U &u) { if (t < u) { t = u; return true; } return false; }
template<class K, class V> using hash_map = gp_hash_table<K, V>;
template<class K> using hash_set = gp_hash_table<K, null_type>;

// #include "titan_cpplib/others/io.cpp"
/// https://github.com/titan-23/Library_cpp/blob/main/titan_cpplib/others/io.cpp

#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;

namespace titan23 {

// 参考: https://qiita.com/nojima/items/57b9d39d7d73362ac883
class Scanner {
private:
    vector<char> buffer;
    ssize_t n_written;
    ssize_t n_read;

    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];
    }

public:
    Scanner(): buffer(1<<20) { do_read(); }

    int64_t read_int64() {
        int64_t 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;
    }

    char read_char() {
        int ch = current_char();
        while (isspace(ch)) {
            ch = next_char();
        }
        next_char();
        return ch;
    }

    string read_string() {
        string ret;
        int ch = current_char();
        while (isspace(ch)) {
            ch = next_char();
        }
        while (!isspace(ch) && ch != EOF) {
            ret += ch;
            ch = next_char();
        }
        return ret;
    }
} scanner;
} // namespace titan23

int64_t read_int64() { return titan23::scanner.read_int64(); }
// #include "titan_cpplib/others/print.cpp"


void solve() {
    int h = read_int64(), w = read_int64();
    vector<uint32_t> S(h);
    ll T = 0;
    rep(i, h) {
        uint32_t s = 0;
        rep(j, w) {
            ll a = read_int64();
            s += a;
        }
        T += s;
        S[i] = s;
    }
    rep(i, h) {
        cout << S[i]+T << "\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);

    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }

    return 0;
}
0