結果
| 問題 | No.3576 写像判定 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-03 21:35:11 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| コード長 | 632 bytes |
| 記録 | |
| コンパイル時間 | 1,424 ms |
| コンパイル使用メモリ | 223,628 KB |
| 実行使用メモリ | 14,720 KB |
| 最終ジャッジ日時 | 2026-07-03 21:35:15 |
| 合計ジャッジ時間 | 3,016 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
int main(void){
cin.tie(nullptr); ios_base::sync_with_stdio(false);
ll i,j;
ll N;
cin >> N;
if(N==0){
cout << "Yes" << endl;
return 0;
}
map<ll,vector<ll>> m;
for(i=1;i<=N;i++){
ll s,t;
cin >> s >> t;
m[s].push_back(t);
}
for(auto c:m){
vector<ll> v=c.second;
sort(v.begin(),v.end());
v.erase(unique(v.begin(),v.end()),v.end());
if((ll)v.size()!=1){
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}