結果

問題 No.3677 Global Checksum
コンテスト
ユーザー achapi
提出日時 2026-09-05 01:29:44
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 3,024 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,430 ms
コンパイル使用メモリ 356,844 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2026-09-05 01:29:58
合計ジャッジ時間 7,205 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
namespace fastio{
static constexpr u_int32_t buf_size=1<<17;
char ibuf[buf_size];
char obuf[buf_size];
u_int32_t pil=0,pir=0,por=0;
struct Pre{
  char t[40000];
  constexpr Pre(){
	for(int i=0;i<10000;i++){
	  int n=i;
	  for(int j=3;j>=0;j--){
		t[i*4+j]='0'+n%10;
		n/=10;
	  }
	}
  }
}constexpr pre;
inline void load(){
  if(pir-pil<=pil)memcpy(ibuf,ibuf+pil,pir-pil);
  else memmove(ibuf,ibuf+pil,pir-pil);
  pir=pir-pil+fread(ibuf+pir-pil,1,buf_size-pir+pil,stdin);
  pil=0;
}
inline void flush(){
  fwrite(obuf,1,por,stdout);
  por=0;
}
inline void rd(char&c){c=ibuf[pil++];}
template<typename T>
inline void rd(T&x){
  if(pil+32>pir)load();
  char c;
  do rd(c); while(c<'-');
  bool neg=false;
  if constexpr(std::is_signed_v<T>){
	if(c=='-'){
	  neg=true;
	  rd(c);
	}
  }
  x=0;
  while(c>='0'){
	x=x*10+(c&15);
	rd(c);
  }
  if constexpr(std::is_signed_v<T>){
	if(neg)x=-x;
  }
}
inline void wt(char x){obuf[por++]=x;}
template<typename T>
inline void wt(T x){
  if(por+32>buf_size)flush();
  if(x==0){
	wt('0');
	return;
  }
  if constexpr(std::is_signed_v<T>){
	if(x<0){
	  wt('-');
	  x=-x;
	}
  }
  if(x>=10000000000000000){
	u_int32_t r1=x%100000000;
	u_int64_t q1=x/100000000;
	u_int32_t r2=q1%100000000;
	u_int32_t q2=q1/100000000;
	u_int32_t n1=r1%10000,n2=r1/10000,n3=r2%10000,n4=r2/10000;
	if(x>=1000000000000000000){
	  memcpy(obuf+por,pre.t+(q2<<2)+1,3);
	  memcpy(obuf+por+3,pre.t+(n4<<2),4);
	  memcpy(obuf+por+7,pre.t+(n3<<2),4);
	  memcpy(obuf+por+11,pre.t+(n2<<2),4);
	  memcpy(obuf+por+15,pre.t+(n1<<2),4);
	  por+=19;
	}
	else if(x>=100000000000000000){
	  u_int32_t q3=(q2*205)>>11;
	  u_int32_t r3=q2-q3*10;
	  obuf[por]='0'+q3;
	  obuf[por+1]='0'+r3;
	  memcpy(obuf+por+2,pre.t+(n4<<2),4);
	  memcpy(obuf+por+6,pre.t+(n3<<2),4);
	  memcpy(obuf+por+10,pre.t+(n2<<2),4);
	  memcpy(obuf+por+14,pre.t+(n1<<2),4);
	  por+=18;
	}
	else{
	  obuf[por]='0'+q2;
	  memcpy(obuf+por+1,pre.t+(n4<<2),4);
	  memcpy(obuf+por+5,pre.t+(n3<<2),4);
	  memcpy(obuf+por+9,pre.t+(n2<<2),4);
	  memcpy(obuf+por+13,pre.t+(n1<<2),4);
	  por+=17;
	}
  }
  else{
	static char buf[12];
	int i=8;
	while(x>=10000){
	  memcpy(buf+i,pre.t+((x%10000)<<2),4);
	  x/=10000;
	  i-=4;
	}
	if(x<100){
	  if(x<10)obuf[por++]='0'+x;
	  else{
		obuf[por]='0'+x/10;
		obuf[por+1]='0'+x%10;
		por+=2;
	  }
	}
	else{
	  if(x<1000){
		memcpy(obuf+por,pre.t+(x<<2)+1,3);
		por+=3;
	  }
	  else{
		memcpy(obuf+por,pre.t+(x<<2),4);
		por+=4;
	  }
	}
	memcpy(obuf+por,buf+i+4,8-i);
	por+=8-i;
  }
}
struct Dummy{
  Dummy(){std::atexit(flush);}
}dummy;
}
using fastio::rd;
using fastio::wt;
int main(){
	unsigned int H, W;
	rd(H), rd(W);
	unsigned int A[H][W];
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			rd(A[i][j]);
		}
	}
	unsigned int S[H];
	for (int i = 0; i < H; i++){
		S[i] = 0;
		for (int j = 0; j < W; j++){
			S[i] += A[i][j];
		}
	}
	unsigned int T = 0;
	for (int i = 0; i < H; i++){
		T += S[i];
	}
	for (int i = 0; i < H; i++){
		wt(S[i] + T);
		wt('\n');
	}
}
0