結果

問題 No.1328 alligachi-problem
ユーザー kotatsugamekotatsugame
提出日時 2020-12-25 20:02:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,038 bytes
コンパイル時間 2,456 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 6,796 KB
最終ジャッジ日時 2023-10-23 19:54:15
合計ジャッジ時間 6,929 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
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 108 ms
5,832 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 107 ms
6,024 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 108 ms
6,024 KB
testcase_24 AC 106 ms
6,604 KB
testcase_25 AC 108 ms
6,024 KB
testcase_26 AC 109 ms
6,796 KB
testcase_27 AC 109 ms
6,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
vector<pair<int,pair<int,int> > >G[2];
main()
{
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		char c,x;int y;cin>>c>>x>>y;
		G[x=='R'].push_back(make_pair(y,make_pair(c=='R',i)));
	}
	for(int i=0;i<2;i++)sort(G[i].begin(),G[i].end());
	vector<int>ans;ans.reserve(N);
	int i0=0,i1=0;
	int c[2]={};
	while(i0<G[0].size()||i1<G[1].size())
	{
		bool f0=false,f1=false;
		if(i0<G[0].size()&&c[0]==G[0][i0].first)f0=true;
		if(i1<G[1].size()&&c[1]==G[1][i1].first)f1=true;
		if(f0&&f1)
		{
			if(G[0][i0].second.first==G[1][i1].second.first)
			{
				if(G[0][i0].second.first==0)
				{
					f1=false;
				}
				else
				{
					f0=false;
				}
			}
		}
		if(f0)
		{
			c[G[0][i0].second.first]++;
			ans.push_back(G[0][i0++].second.second);
		}
		else if(f1)
		{
			c[G[1][i1].second.first]++;
			ans.push_back(G[1][i1++].second.second);
		}
		else
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<N;i++)cout<<ans[i]<<(i+1==N?"\n":" ");
}
0