結果

問題 No.709 優勝可能性
ユーザー merom686merom686
提出日時 2018-06-29 23:09:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 122 ms / 3,500 ms
コード長 1,056 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 78,456 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 00:11:52
合計ジャッジ時間 2,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    int s[10] = {};
    vector<int> t(n), v[10];
    for (int j = 0; j < m; j++) {
        v[j] = vector<int>();
    }
    int x = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            int r;
            cin >> r;
            if (r > s[j]) {
                for (auto& i1 : v[j]) {
                    t[i1] ^= 1 << j;
                    if (t[i1] == 0) x--;
                }
                v[j].clear();

                if (t[i] == 0) x++;
                s[j] = r;
                t[i] ^= 1 << j;
                v[j].push_back(i);

            } else if (r == s[j]) {
                if (t[i] == 0) x++;
                t[i] ^= 1 << j;
                v[j].push_back(i);
            }
        }
        cout << x << '\n';
    }

    return 0;
}
0