結果

問題 No.3677 Global Checksum
コンテスト
ユーザー Kude
提出日時 2026-09-04 23:42:50
言語 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
結果
AC  
実行時間 60 ms / 200 ms
+ 932µs
コード長 1,524 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,988 ms
コンパイル使用メモリ 358,108 KB
実行使用メモリ 46,764 KB
最終ジャッジ日時 2026-09-04 23:43:02
合計ジャッジ時間 7,660 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;

char buf[(int)4e7 + 50];
auto ptr = buf;

} int main() {
  read(0, buf, ssize(buf));
  auto get_val = []() {
    unsigned int x = 0;
    while (true) {
      char c = *ptr++;
      if (c == ' ' || c == '\n') break;
      x = 10U * x + c - '0';
    }
    return x;
  };
  int h = get_val(), w = get_val();
  static unsigned int s[1000000];
  unsigned int t = 0;
  rep(i, h) {
    unsigned int acc = 0;
    rep(j, w) acc += get_val();
    s[i] = acc;
    t += acc;
  }
  ptr = buf;
  rep(i, h) {
    char d[10];
    int p = 10;
    unsigned int res = s[i] + t;
    if (res == 0) {
      d[--p] = '0';
    } else {
      do {
        d[--p] = '0' + res % 10;
        res /= 10;
      } while (res);
    }
    while (p < 10) *ptr++ = d[p++];
    *ptr++ = '\n';
  }
  write(1, buf, ptr - buf);
}
0