結果

問題 No.1328 alligachi-problem
ユーザー 👑 NachiaNachia
提出日時 2020-12-25 00:06:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 208,988 KB
実行使用メモリ 7,464 KB
最終ジャッジ日時 2023-10-21 15:54:39
合計ジャッジ時間 10,882 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 3 ms
4,348 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 113 ms
5,928 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 113 ms
5,928 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 112 ms
5,932 KB
testcase_24 AC 112 ms
5,928 KB
testcase_25 AC 112 ms
6,120 KB
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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; }
	}
	else cout<<"No"<<endl;
	return 0;
}
0