結果

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

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

// حل مشكلة Visual Studio (Windows) مع Linux Fast I/O
#ifdef _WIN32
    #define getchar_unlocked _getchar_nolock
    #define putchar_unlocked _putchar_nolock
#endif

// Fast I/O reading unsigned long long
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 int
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;

    // Fast processing using implicit mod 2^32 via 32-bit 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);
        }
        S[i] = sumR;
        T += sumR;
    }

    for (size_t i = 0; i < H; ++i) {
        unsigned int Ci = S[i] + T;
        printUnsignedInt(Ci);
    }
}

int main() {
    Do_ur_job();
    return 0;
}
0