結果

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

ソースコード

diff #
raw source code

#pragma GCC target("prefer-vector-width=512")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

// https://nyaannyaan.github.io/library/misc/fastio.hpp
namespace nyaan {
namespace internal {
using namespace std;
template <typename T>
using is_broadly_integral =
	typename conditional_t<is_integral_v<T> || is_same_v<T, __int128_t> ||
							   is_same_v<T, __uint128_t>,
						   true_type,
						   false_type>::type;

template <typename T>
using is_broadly_signed =
	typename conditional_t<is_signed_v<T> || is_same_v<T, __int128_t>,
						   true_type,
						   false_type>::type;

template <typename T>
using is_broadly_unsigned =
	typename conditional_t<is_unsigned_v<T> || is_same_v<T, __uint128_t>,
						   true_type,
						   false_type>::type;

#define ENABLE_VALUE(x)   \
	template <typename T> \
	constexpr bool x##_v = x<T>::value;

ENABLE_VALUE(is_broadly_integral);
ENABLE_VALUE(is_broadly_signed);
ENABLE_VALUE(is_broadly_unsigned);
#undef ENABLE_VALUE

#define ENABLE_HAS_TYPE(var)                                     \
	template <class, class = void>                               \
	struct has_##var : false_type {};                            \
	template <class T>                                           \
	struct has_##var<T, void_t<typename T::var>> : true_type {}; \
	template <class T>                                           \
	constexpr auto has_##var##_v = has_##var<T>::value;

#define ENABLE_HAS_VAR(var)                                       \
	template <class, class = void>                                \
	struct has_##var : false_type {};                             \
	template <class T>                                            \
	struct has_##var<T, void_t<decltype(T::var)>> : true_type {}; \
	template <class T>                                            \
	constexpr auto has_##var##_v = has_##var<T>::value;
}  // namespace internal

namespace fastio {
using namespace std;
static constexpr int SZ = 1 << 17;
static constexpr int offset = 64;
char inbuf[SZ], outbuf[SZ];
int in_left = 0, in_right = 0, out_right = 0;

struct Pre {
	char num[40000];
	constexpr Pre() : num() {
		for (int i = 0; i < 10000; i++) {
			int n = i;
			for (int j = 3; j >= 0; j--) {
				num[i * 4 + j] = n % 10 + '0';
				n /= 10;
			}
		}
	}
} constexpr pre;

void load() {
	int len = in_right - in_left;
	memmove(inbuf, inbuf + in_left, len);
	in_right = len + fread(inbuf + len, 1, SZ - len, stdin);
	in_left = 0;
}
void flush() {
	fwrite(outbuf, 1, out_right, stdout);
	out_right = 0;
}
void skip_space() {
	if (in_left + offset > in_right) load();
	while (inbuf[in_left] <= ' ') in_left++;
}

void single_read(char& c) {
	if (in_left + offset > in_right) load();
	skip_space();
	c = inbuf[in_left++];
}
void single_read(string& S) {
	skip_space();
	while (true) {
		if (in_left == in_right) load();
		int i = in_left;
		for (; i != in_right; i++) {
			if (inbuf[i] <= ' ') break;
		}
		copy(inbuf + in_left, inbuf + i, back_inserter(S));
		in_left = i;
		if (i != in_right) break;
	}
}
template <typename T,
		  enable_if_t<internal::is_broadly_integral_v<T>>* = nullptr>
void single_read(T& x) {
	if (in_left + offset > in_right) load();
	skip_space();
	char c = inbuf[in_left++];
	[[maybe_unused]] bool minus = false;
	if constexpr (internal::is_broadly_signed_v<T>) {
		if (c == '-') minus = true, c = inbuf[in_left++];
	}
	x = 0;
	while (c >= '0') {
		x = x * 10 + (c & 15);
		c = inbuf[in_left++];
	}
	if constexpr (internal::is_broadly_signed_v<T>) {
		if (minus) x = -x;
	}
}
void rd() {
}
template <typename Head, typename... Tail>
void rd(Head& head, Tail&... tail) {
	single_read(head);
	rd(tail...);
}

void single_write(const char& c) {
	if (out_right > SZ - offset) flush();
	outbuf[out_right++] = c;
}
void single_write(const bool& b) {
	if (out_right > SZ - offset) flush();
	outbuf[out_right++] = b ? '1' : '0';
}
void single_write(const string& S) {
	flush(), fwrite(S.data(), 1, S.size(), stdout);
}
void single_write(const char* p) {
	flush(), fwrite(p, 1, strlen(p), stdout);
}
template <typename T,
		  enable_if_t<internal::is_broadly_integral_v<T>>* = nullptr>
void single_write(const T& _x) {
	if (out_right > SZ - offset) flush();
	if (_x == 0) {
		outbuf[out_right++] = '0';
		return;
	}
	T x = _x;
	if constexpr (internal::is_broadly_signed_v<T>) {
		if (x < 0) outbuf[out_right++] = '-', x = -x;
	}
	constexpr int buffer_size = sizeof(T) * 10 / 4;
	char buf[buffer_size];
	int i = buffer_size;
	while (x >= 10000) {
		i -= 4;
		memcpy(buf + i, pre.num + (x % 10000) * 4, 4);
		x /= 10000;
	}
	if (x < 100) {
		if (x < 10) {
			outbuf[out_right] = '0' + x;
			++out_right;
		} else {
			uint32_t q = (uint32_t(x) * 205) >> 11;
			uint32_t r = uint32_t(x) - q * 10;
			outbuf[out_right] = '0' + q;
			outbuf[out_right + 1] = '0' + r;
			out_right += 2;
		}
	} else {
		if (x < 1000) {
			memcpy(outbuf + out_right, pre.num + (x << 2) + 1, 3);
			out_right += 3;
		} else {
			memcpy(outbuf + out_right, pre.num + (x << 2), 4);
			out_right += 4;
		}
	}
	memcpy(outbuf + out_right, buf + i, buffer_size - i);
	out_right += buffer_size - i;
}
void wt() {
}
template <typename Head, typename... Tail>
void wt(const Head& head, const Tail&... tail) {
	single_write(head);
	if constexpr (sizeof...(tail)) wt(' ');
	wt(std::forward<const Tail>(tail)...);
}
template <typename... Args>
void wtn(const Args&... x) {
	wt(std::forward<const Args>(x)...);
	wt('\n');
}
struct Dummy {
	Dummy() {
		atexit(flush);
	}
} dummy;
#define cin CANNOT_USE_WITH_FASTIO
#define cout CANNOT_USE_WITH_FASTIO
}  // namespace fastio
}  // namespace nyaan

using nyaan::fastio::rd;
using nyaan::fastio::skip_space;
using nyaan::fastio::wt;
using nyaan::fastio::wtn;

using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
	return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
	return x < y ? (x = y, true) : false;
}

using u32 = uint32_t;

void solve() {
	int h, w;
	rd(h, w);
	vector<u32> a(h * w);
	rep(i, 0, h) rep(j, 0, w) rd(a[i * w + j]);
	vector<u32> s(h);
	rep(i, 0, h) rep(j, 0, w) s[i] += a[i * w + j];
	u32 t = 0;
	rep(i, 0, h) t += s[i];
	rep(i, 0, h) wtn(s[i] + t);
}

int main() {
	// ios::sync_with_stdio(false);
	// cin.tie(nullptr);
	// cout << fixed << setprecision(15);
	int t = 1;
	// cin >> t;
	while (t--) solve();
}
0