結果

問題 No.709 優勝可能性
ユーザー i_mrhji_mrhj
提出日時 2020-03-22 19:12:37
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 300 ms / 3,500 ms
コード長 745 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 29,412 KB
実行使用メモリ 6,184 KB
最終ジャッジ日時 2023-08-26 18:29:40
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 53 ms
6,084 KB
testcase_11 AC 24 ms
6,128 KB
testcase_12 AC 126 ms
6,184 KB
testcase_13 AC 298 ms
6,084 KB
testcase_14 AC 261 ms
6,124 KB
testcase_15 AC 251 ms
6,124 KB
testcase_16 AC 247 ms
6,112 KB
testcase_17 AC 245 ms
6,092 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 299 ms
6,184 KB
testcase_21 AC 300 ms
6,144 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int
main(int argc, char *argv[])
{
    int n, m;
    scanf("%d %d", &n, &m);
    
    int r[100001][11];
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf("%d", &r[i][j]);
    
    int Max[11], ol[1200] = {}, k, l, ans;
    for (int i = 0; i < n; i++) {
        k = l = 0;
        for (int j = 0; j < m; j++) {
            if (Max[j]  < r[i][j]) k += 1 << j, Max[j] = r[i][j];
            if (Max[j] == r[i][j]) l += 1 << j;
        }
        for (int j = 0; j < 1 << m; j++) {
            if ((j & k) != 0) ol[j - (j & k)] += ol[j], ol[j] = 0;
        }
        ol[k | l]++;
        ans = 0;
        for (int j = 1; j < 1 << m; j++) ans += ol[j];
        printf("%d\n", ans);
    }
    
    return 0;
    
}
0