結果
| 問題 | No.3622 Perfect Matching of Crab |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 21:51:25 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 337 ms / 2,000 ms |
| + 77µs | |
| コード長 | 779 bytes |
| 記録 | |
| コンパイル時間 | 2,062 ms |
| コンパイル使用メモリ | 337,512 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2026-08-14 21:51:33 |
| 合計ジャッジ時間 | 7,608 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
n *= 2;
map<int, int> cnt1, cnt2;
int tot1 = 0, tot2 = 0;
rep(i, n) {
int x, y; char c;
cin >> x >> y >> c;
if (c == 'x') {
++tot1;
++cnt1[y];
}
else {
++tot2;
++cnt2[x];
}
}
int ox = 0, oy = 0;
for (auto& p : cnt1) {
if (p.second&1) ++ox;
}
for (auto& p : cnt2) {
if (p.second&1) ++oy;
}
if (max(ox, oy) <= min(tot1, tot2)) puts("Yes");
else puts("No");
}
int main() {
int t;
cin >> t;
while (t--) solve();
return 0;
}