結果

問題 No.3677 Global Checksum
コンテスト
ユーザー あいすあうと
提出日時 2026-09-05 00:28:17
言語 C++23(gnu拡張gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=gnu++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 92 ms / 200 ms
+ 781µs
コード長 2,874 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,017 ms
コンパイル使用メモリ 387,836 KB
実行使用メモリ 47,748 KB
最終ジャッジ日時 2026-09-05 00:28:37
合計ジャッジ時間 7,911 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using i128=__int128;
using P=pair<ll,ll>;
template<typename T> using vc=vector<T>;
template<typename T> using vv=vc<vc<T>>;
using vl=vc<ll>;
using vvl=vc<vc<ll>>;
using vul=vc<ull>;
using vs=vc<string>;
using vb=vc<bool>;
#define rep(i,s,n) for(ll i=s;i<(n);i++)
#define Rep(i,s,n) for(ll i=n;i>=s;i--)
#define nall(x) x.begin(),x.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define nexp(v) next_permutation(v)
#define prep(v) prev_permutation(v)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define M1 cout<<"-1"<<endl
const long long INF=(1LL<<62)-(1LL<<31)-1;
#define endl '\n'
using mint=modint998244353;
using mint7=modint1000000007;
//vl dx={1,-1,0,0};vl dy={0,0,1,-1};
//vl dx={0,0,1,1,1,-1,-1,-1};vl dy={1,-1,0,1,-1,0,1,-1};
bool out_grid(ll i, ll j, ll h, ll w){return (!(0<=i && i<h && 0<=j && j<w));}
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll ceil_div(ll a,ll b){return (a+(b-1))/b;}

namespace fastio{
    const int sz=1<<26;
    char buf[sz+1];
    char *p=buf;
    bool initialized=false;

    inline bool refill(){
        int n=::read(0,buf,sz);
        if(n<=0){
            buf[0]=0;
            p=buf;
            return false;
        }
        buf[n]=0;
        p=buf;
        return true;
    }

    inline void init(){
        if(!initialized){
            refill();
            initialized=true;
        }
    }

    template<typename T>
    inline T read(){
        if(!initialized)init();

        while(1){
            while(*p<'0' || '9'<*p){
                if(*p==0){
                    if(!refill())return T(0);
                }else{
                    ++p;
                }
            }

            T x=0;

            while(1){
                while('0'<=*p && *p<='9'){
                    x=x*10+(*p-'0');
                    ++p;
                }

                if(*p!=0)return x;

                if(!refill())return x;

                if(*p<'0' || '9'<*p)return x;
            }
        }
    }

    inline void write_u32(uint32_t x,char *&q){
        auto [n,ec]=to_chars(q,q+10,x);
        q=n;
    }
}
using namespace fastio;

int main(){
	init();
	int h=read<int>(),w=read<int>();
    vc<uint32_t> s(h);
    uint32_t t=0;
    rep(i,0,h){
        uint32_t sum=0;
        rep(j,0,w){
            uint32_t a=read<uint32_t>();
            sum+=a;
            t+=a;
        }
        s[i]=sum;
    }
    char *b=buf;
    rep(i,0,h){
        write_u32(s[i]+t,b);
        *b++=endl;
    }
    ::write(1,buf,b-buf);
}
0