結果

問題 No.3677 Global Checksum
コンテスト
ユーザー Ahmed Mabrouk
提出日時 2026-09-04 23:18:35
言語 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  
実行時間 -
コード長 7,712 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,928 ms
コンパイル使用メモリ 368,904 KB
実行使用メモリ 9,788 KB
最終ジャッジ日時 2026-09-04 23:18:42
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 1 -- * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void Do_ur_job()':
main.cpp:331:18: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
  331 |             sumR += (unsigned int)(x & 0xFFFFFFFFULL); // (x mod 2^32)
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:329:32: note: 'x' was declared here
  329 |             unsigned long long x;
      |                                ^

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define mod 998244353
#define YES cout << "YES" <<endl;
#define Yes cout << "Yes" <<endl;
#define yes cout << "yes" <<endl;
#define NO cout << "NO" <<endl;
#define No cout << "No" <<endl;
#define no cout << "no" <<endl;
#define all(x) x.begin(), x.end()
#define ll long long
#define ull unsigned ll
#define pll pair<ll,ll>
#define ld long double
#define OO 1e18
#define UOO 18446744073709551615
#define INF 0x3f3f3f3f
#define PANIC_ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define IO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define forn for (ll i =0; i<n; i++)
#define fr(i, a, b) for (int i = a; i < b; i++)
#define forn1 for (ll i =1; i<=n; i++)
#define prq priority_queue<ll>
#define vint vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vchar vector<char>
#define vstring vector<string>
#define dll deque<ll>
#define el "\n"
#define wide5 setw(5) << setiosflags(ios::right)
#define popCnt(x) (__builtin_popcountll(x))
const ll MAX = 2e5 + 5, MOD = 1e9 + 7, N = 2e5 + 5;
const int dx[] = { -1, -1, 0, -1, 1, 1, 0, 1 };
const int dy[] = { 0, -1, -1, 1, 0, 1, 1, -1 };
ll fast_pow(ll a, ll p) {
    int res = 1;
    while (p) {
        if (p % 2 == 0) {
            a = a * 1ll * a % mod;
            p /= 2;
        }
        else {
            res = res * 1ll * a % mod;
            p--;
        }
    }
    return res;
}
ull gcd(ull a, ull b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ull lcm(ull a, ull b)
{
    return (a / gcd(a, b)) * b;
}
ull f(ull a) {
    return (a * (a + 1)) / 2;
}
bool isPalindrome(string S)
{
    string P = S;
    reverse(P.begin(), P.end());
    if (S == P)return true;
    return false;
}
ull factorial(ull n) {
    ull f;
    for (f = 1; n > 1; n--)
        f = f * n % MOD;
    return f;
}

ull npr(ull n, ull r) {
    return factorial(n) / factorial(n - r);
}
ull ncr(ull n, ull r)
{
    ll p = 1, k = 1;
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            ll m = gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
        p = 1;
    return p;
}
ull countOdd(ull L, ull R) {
    ull N = (R - L) / 2;
    if (R % 2 || L % 2)
        N += 1;
    return N;
}
bool is_prime(ll n) {
    if (n <= 1)return false;
    if (n <= 3)return true;
    if (n % 2 == 0 || n % 3 == 0)return false;
    for (ll i = 5; i * i <= n; i += 6) {
        if (n % i == 0 || n % (i + 2) == 0)return false;
    }
    return true;
}
ll countDivisibles(ll A, ll B, ll M)
{
    if (A % M == 0)
        return (B / M) - (A / M) + 1;
    return (B / M) - (A / M);
}
ll countDivisiblesByTwoNumbers(ll N, ll A, ll B)
{
    return ceil((N / lcm(A, B)));
}
bool checkifdivisable(string& n, ll k) {
    ll rem = 0;
    for (auto i : n) {
        rem = ((rem * 10) + i - '0') % k;
    }
    return rem == 0;
}

string lower(string s) {
    for (int i = 0; i < s.length(); i++)s[i] = tolower(s[i]);
    return s;
}
string upper(string s) {
    for (int i = 0; i < s.length(); i++)s[i] = toupper(s[i]);
    return s;
}
bool is_overlapping(ll x1, ll x2, ll y1, ll y2) {
    return (max(x1, y1) < min(x2, y2));
}
ll digit(ll n) {
    return floor(log10(n) + 1);
}
vector<ll> primeFactors(ll n)
{
    vll arr;
    //set<ll>arr;
    while (n % 2 == 0)
    {
        //arr.insert(2);
        arr.push_back(2);
        n = n / 2;
    }
    for (int i = 3; i * i <= n; i = i + 2)
    {
        while (n % i == 0)
        {
            //arr.insert(i);
            arr.push_back(i);
            n = n / i;
        }
    }
    //if (n > 2)arr.insert(n);
    if (n > 2)arr.push_back(n);
    return arr;
}
double sumpow(double n, double p)
{
    return pow(n, p + 1) - 1;
}
bool sa7e7(ld n) {
    return (ceil(n) == floor(n));
}
set<ll> getDivisors(ll n)
{
    //vll dv;
    set<ll>st;
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            //dv.push_back(i);
            st.insert(i);
            if (n % (n / i) == 0) {
                //dv.push_back(n / i);
                st.insert(n / i);
            }
        }
    }
    //return dv;
    return st;
}
ll convert(ll m, ll n)
{
    if (m == n)return 0;
    if (m > n)return m - n;
    if (n % 3 != 0)return 1 + convert(m, n + 1);
    else return 1 + convert(m, n / 3);
}
ll removeBit(ll mask, ll bit) {
    return mask & ~(1ll << bit);
}
ll addBit(ll mask, ll bit) {
    return mask | (1ll << bit);
}
string getString(char x)
{
    string s(1, x);
    return s;
}
bool perfect_square(ll n) {
    ll x = sqrt(n);
    return (x * x == n);
}
ll cnt2(ll n) {
    ll x = 0;
    while (n % 2 == 0) {
        x++; n /= 2;
    }
    return x;
}
bool pow2(ll n) {
    return !n || !(n - 1 & n);
}
ll sum_digit(ll n) {
    string s = to_string(n);
    ll sum = 0;
    for (int i = 0; i < s.length(); i++)sum += (s[i] - '0');
    return sum;
}
ld log_a_to_base_b(ld a, ld b)
{
    return (ld)((ld)log2(a) / (ld)log2(b));
}
ll B2D(string s) {
    reverse(all(s));
    ll sum = 0;
    for (int i = 0; i < min((ll)s.length(), 32LL); i++) {
        if (s[i] == '1')sum += pow(2, i);
    }
    return sum;
}
string D2B(ll n)
{
    ll binaryNum[32];
    ll i = 0;
    while (n > 0) {
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }
    string s = "";
    for (int j = i - 1; j >= 0; j--)
        s += (char)(binaryNum[j] + '0');
    return s;
}
ll mul(ll a, ll b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}
ll add(ll a, ll b) {
    return ((a % MOD) + (b % MOD)) % MOD;
}
ll sub(ll a, ll b) {
    return ((a % MOD) - (b % MOD)) % MOD;
}
ll fstpow(ll b, ll p) {
    if (p == 0)return 1;
    if (p == 1)return b;
    ll hp = fstpow(b, p / 2);
    ll ans = mul(hp, hp);
    if (p % 2)ans = mul(ans, b);
    return ans % mod;
}
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
#endif
// Fast I/O reading integers
inline bool readUnsignedInt(unsigned long long& n) {
    int c = getchar_unlocked();
    if (c == EOF) return false;
    while (c < '0' || c > '9') {
        c = getchar_unlocked();
        if (c == EOF) return false;
    }
    n = 0;
    while (c >= '0' && c <= '9') {
        n = n * 10 + (c - '0');
        c = getchar_unlocked();
    }
    return true;
}

// Fast I/O writing unsigned integers
inline void printUnsignedInt(unsigned int n) {
    if (n == 0) {
        putchar_unlocked('0');
        putchar_unlocked('\n');
        return;
    }
    char buf[12];
    int i = 0;
    while (n > 0) {
        buf[i++] = (char)('0' + (n % 10));
        n /= 10;
    }
    while (i > 0) {
        putchar_unlocked(buf[--i]);
    }
    putchar_unlocked('\n');
}
//*******************************************************************
void Do_ur_job() {
    unsigned long long H, W;
    if (!readUnsignedInt(H) || !readUnsignedInt(W)) return;

    vector<unsigned int> S(H, 0);
    unsigned int T = 0;

    // Modulo 2^32 is handled automatically by overflow in 'unsigned int'
    for (size_t i = 0; i < H; ++i) {
        unsigned int sumR = 0;
        for (size_t j = 0; j < W; ++j) {
            unsigned long long x;
            readUnsignedInt(x);
            sumR += (unsigned int)(x & 0xFFFFFFFFULL); // (x mod 2^32)
        }
        S[i] = sumR;
        T += sumR; // Automatic mod 2^32
    }

    for (size_t i = 0; i < H; ++i) {
        unsigned int Ci = S[i] + T; // Automatic mod 2^32
        printUnsignedInt(Ci);
    }
}
int main() { //IO
    PANIC_;;
    ll t = 1;
    // cin >> t;
    for (ll i = 0; i < t; i++)Do_ur_job();
    return 0;
}
0