結果

問題 No.709 優勝可能性
ユーザー i_mrhji_mrhj
提出日時 2020-03-22 18:51:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 272 ms / 3,500 ms
コード長 1,404 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 93,164 KB
実行使用メモリ 19,224 KB
最終ジャッジ日時 2023-08-26 17:39:31
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 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 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 59 ms
19,116 KB
testcase_11 AC 33 ms
19,116 KB
testcase_12 AC 124 ms
19,224 KB
testcase_13 AC 260 ms
19,108 KB
testcase_14 AC 233 ms
19,120 KB
testcase_15 AC 225 ms
19,092 KB
testcase_16 AC 222 ms
19,080 KB
testcase_17 AC 220 ms
19,152 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 271 ms
19,176 KB
testcase_21 AC 272 ms
19,180 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}
ll r[100100][20];

int main(void) {
  
  int n, m;
  scanf("%d %d", &n, &m);
  
  rep(i, n) rep(j, m) scanf("%lld", &r[i][j]);

  ll ma[20] = {}; int p[20] = {}, ol[1200] = {}, k, l;
  rep(i, n) {
    //cout << "*** " << i + 1 << " ***" << endl;
    k = 0; l = 0;
    rep(j, m) {
      if (ma[j] < r[i][j]) {
	//cout << 1 << endl;
	ma[j] = r[i][j];
	k += 1 << j;
      } else if (ma[j] == r[i][j]) {
	l += 1 << j;
	//cout << 2 << endl;
      }
    }
    //cout << k << " " << l << endl;
    rep(j, 1 << m) {
      if ((j & k) != 0) {
	ol[j - (j & k)] += ol[j];
	ol[j] = 0;
      }
    }
    ol[k | l]++;
    int ans = 0;
    for (int j = 1; j < 1 << m; j++) ans += ol[j];
    printf("%d\n", ans);
  }
  return 0;
  
}
      
0