結果

問題 No.709 優勝可能性
ユーザー i_mrhji_mrhj
提出日時 2020-03-22 19:02:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 306 ms / 3,500 ms
コード長 786 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 42,264 KB
実行使用メモリ 7,320 KB
最終ジャッジ日時 2023-08-26 18:08:55
合計ジャッジ時間 4,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 53 ms
7,252 KB
testcase_11 AC 25 ms
7,308 KB
testcase_12 AC 125 ms
7,316 KB
testcase_13 AC 277 ms
7,320 KB
testcase_14 AC 266 ms
7,312 KB
testcase_15 AC 258 ms
7,276 KB
testcase_16 AC 254 ms
7,208 KB
testcase_17 AC 251 ms
7,320 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 306 ms
7,316 KB
testcase_21 AC 306 ms
7,272 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
using namespace std;

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