結果
| 問題 | No.709 優勝可能性 |
| コンテスト | |
| ユーザー |
i_mrhj
|
| 提出日時 | 2020-03-22 18:51:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 259 ms / 3,500 ms |
| コード長 | 1,404 bytes |
| 記録 | |
| コンパイル時間 | 818 ms |
| コンパイル使用メモリ | 96,656 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-12-25 17:00:59 |
| 合計ジャッジ時間 | 5,630 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#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;
}
i_mrhj