結果

問題 No.1328 alligachi-problem
ユーザー 👑 Nachia
提出日時 2020-12-25 00:06:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 199,100 KB
最終ジャッジ日時 2025-01-17 06:46:13
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 8 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const string colors = "RB";
int colorid(char c){ return colors.find(c); }

struct Ball{ int x,y,i; };
bool cmp_Ball_y(Ball l,Ball r){ return l.y<r.y; }

int main(){
	int N; cin>>N;
	vector<Ball> D[2];
	rep(i,N){ char c,x; int y; cin>>c>>x>>y; D[colorid(c)].push_back({colorid(x),y,i}); }
	rep(i,2) sort(D[i].begin(),D[i].end(),cmp_Ball_y);
	bool ok=true;
	rep(i,2) rep(j,D[i].size()) if(D[i][j].y!=j) ok=false;
	if(ok){
		cout<<"Yes"<<endl;
		bool sp=false;
		rep(i,2) for(auto b:D[i]){ if(sp)cout<<" "; cout<<(b.i+1); sp=true; }
		cout<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}
0