結果
| 問題 | No.3622 Perfect Matching of Crab |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 21:27:05 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 168 ms / 2,000 ms |
| + 387µs | |
| コード長 | 1,135 bytes |
| 記録 | |
| コンパイル時間 | 2,015 ms |
| コンパイル使用メモリ | 338,876 KB |
| 実行使用メモリ | 13,184 KB |
| 最終ジャッジ日時 | 2026-08-14 21:27:11 |
| 合計ジャッジ時間 | 5,841 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
set<int> sx;
set<int> sy;
int cx = 0, cy = 0;
int px = 0, py = 0;
rep(i, 2 * n) {
int x, y;
char c;
cin >> x >> y >> c;
if (c == 'x') {
cx++;
if (sx.contains(y)) {
sx.erase(y);
px++;
} else {
sx.insert(y);
}
} else {
cy++;
if (sy.contains(x)) {
sy.erase(x);
py++;
} else {
sy.insert(x);
}
}
}
if (cx > cy) {
cout << ((cx - cy) / 2 <= px ? "Yes" : "No") << endl;
} else {
cout << ((cy - cx) / 2 <= py ? "Yes" : "No") << endl;
}
}
return 0;
}