結果

問題 No.1390 Get together
ユーザー kappybarkappybar
提出日時 2021-02-12 21:37:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 174,556 KB
実行使用メモリ 25,276 KB
最終ジャッジ日時 2023-09-27 03:16:11
合計ジャッジ時間 5,770 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 3 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 AC 184 ms
21,580 KB
testcase_18 AC 157 ms
24,896 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 156 ms
24,936 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 160 ms
25,000 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y));
#define chmax(x,y) x = max((x),(y));
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> b(n),c(n);
    rep(i,n) cin >> b[i] >> c[i];
    rep(i,n) --b[i], --c[i];
    vector<int> cnt(n,0);
    vector<map<int,int>> in(m);
    rep(i,n){
        cnt[c[i]] ++;
        in[b[i]][c[i]] ++;
    }
    vector<int> mx(n,0);
    rep(i,m){
        for(auto p:in[i]){
            chmax(mx[p.first],p.second);
        }
    }
    int ans = 0;
    for(int color = 0; color < n;color ++){
        if(cnt[color] == 0) continue;
        int s = cnt[color];
        ans += s - mx[color];
    }
    cout << ans << endl;
    return 0;
}
0