結果
| 問題 | No.3622 Perfect Matching of Crab |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-24 12:24:10 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 160 ms / 2,000 ms |
| + 130µs | |
| コード長 | 717 bytes |
| 記録 | |
| コンパイル時間 | 3,367 ms |
| コンパイル使用メモリ | 360,536 KB |
| 実行使用メモリ | 13,184 KB |
| 最終ジャッジ日時 | 2026-11-24 12:24:42 |
| 合計ジャッジ時間 | 8,994 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#define All(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
using ll=long long;
void solve(){
int n;
cin>>n;
map<int,int> mpx,mpy;
for(int i=1;i<=2*n;++i){
int x,y; char ch;
cin>>x>>y>>ch;
if(ch=='x'){
mpx[y]++;
} else{
mpy[x]++;
}
}
int smx=0,smy=0,tx=0,ty=0;
for(auto &[y,t]:mpx)
smx+=t/2,tx+=t;
for(auto &[x,t]:mpy)
smy+=t/2,ty+=t;
if(tx<ty-2*smy||tx-2*smx>ty)
cout<<"No\n";
else
cout<<"Yes\n";
}
signed main(){
IOS
int T=1;
cin>>T;
while(T--){
solve();
}
}