結果
| 問題 |
No.1390 Get together
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-12 21:56:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 2,019 ms |
| コンパイル使用メモリ | 199,024 KB |
| 最終ジャッジ日時 | 2025-01-18 18:27:52 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 5 TLE * 14 |
ソースコード
/**
* author: shu8Cream
* created: 12.02.2021 21:19:22
**/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,m;
cin >> n >> m;
vi b(n),c(n),slime(n),bara;
rep(i,n){
cin >> b[i] >> c[i];
slime[c[i]]++;
}
rep(i,n) if(slime[i]>1) bara.push_back(i);
//rep(i,bara.size()) cout << bara[i] << endl;
int ans = 0;
rep(i,bara.size()){
set<int> s;
rep(j,n){
if(c[j]==bara[i]) s.insert(b[j]);
}
ans+=s.size()-1;
}
cout << ans << endl;
}