結果

問題 No.709 優勝可能性
ユーザー ats5515ats5515
提出日時 2018-06-29 22:52:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 258 ms / 3,500 ms
コード長 944 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 21,036 KB
最終ジャッジ日時 2023-09-13 15:31:21
合計ジャッジ時間 4,401 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 173 ms
9,720 KB
testcase_11 AC 150 ms
9,524 KB
testcase_12 AC 217 ms
12,800 KB
testcase_13 AC 227 ms
15,420 KB
testcase_14 AC 213 ms
15,332 KB
testcase_15 AC 211 ms
15,752 KB
testcase_16 AC 204 ms
16,804 KB
testcase_17 AC 212 ms
21,036 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 256 ms
15,328 KB
testcase_21 AC 258 ms
15,336 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<vector<int> > A(N, vector<int>(M));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}
	vector<int> C(N, 0);
	vector<int> mx(M, -1);
	vector<vector<int> > l(M);
	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (mx[j] < A[i][j]) {
				mx[j] = A[i][j];
				for (auto a : l[j]) {
					C[a]--;
					if (C[a] == 0)res--;
				}
				l[j].clear();
				l[j].push_back(i);
				if (C[i] == 0)res++;
				C[i]++;
			}
			else if (mx[j] == A[i][j]) {
				l[j].push_back(i);
				if (C[i] == 0)res++;
				C[i]++;
			}
		}
		cout << res << endl;
	}

}
0