結果

問題 No.709 優勝可能性
ユーザー mamekinmamekin
提出日時 2018-06-29 22:45:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 662 ms / 3,500 ms
コード長 1,319 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 106,936 KB
実行使用メモリ 10,220 KB
最終ジャッジ日時 2023-09-13 15:29:48
合計ジャッジ時間 7,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 250 ms
8,604 KB
testcase_11 AC 178 ms
8,532 KB
testcase_12 AC 418 ms
10,172 KB
testcase_13 AC 513 ms
10,056 KB
testcase_14 AC 479 ms
10,220 KB
testcase_15 AC 451 ms
10,140 KB
testcase_16 AC 432 ms
10,160 KB
testcase_17 AC 435 ms
10,216 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 662 ms
10,192 KB
testcase_21 AC 659 ms
10,188 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int> > r(n, vector<int>(m));
    for(int i=0; i<n; ++i){
        for(int j=0; j<m; ++j){
            cin >> r[i][j];
        }
    }

    vector<int> rMax(m, INT_MIN);
    vector<int> v(1<<m, 0);
    for(int i=0; i<n; ++i){
        bitset<10> bs, isUpdate;
        for(int j=0; j<m; ++j){
            if(rMax[j] < r[i][j]){
                rMax[j] = r[i][j];
                isUpdate[j] = true;
            }
            if(rMax[j] == r[i][j])
                bs[j] = true;
        }
        for(int j=0; j<(1<<m); ++j){
            int tmp = v[j];
            v[j] = 0;
            bitset<10> x(j);
            x &= ~isUpdate;
            v[x.to_ulong()] += tmp;
        }
        ++ v[bs.to_ulong()];

        int ans = i + 1 - v[0];
        cout << ans << endl;
    }

    return 0;
}
0