結果

問題 No.110 しましまピラミッド
ユーザー kotatsugamekotatsugame
提出日時 2017-08-10 04:48:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 75,452 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 06:24:19
合計ジャッジ時間 1,515 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 1 ms
6,940 KB
testcase_15 WA -
testcase_16 AC 1 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 WA -
testcase_26 AC 1 ms
6,940 KB
testcase_27 WA -
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<queue>
using namespace std;
priority_queue<int>W,B;
int n,a,now,cnt;
main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a,W.push(a);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a,B.push(a);
	bool f=W.top()>B.top();
	now=114514;
	while(f?!W.empty():!B.empty())
	{
		if(f)
		{
			while(!W.empty()&&W.top()>=now)W.pop();
			if(!W.empty())now=W.top(),W.pop(),cnt++;
		}
		else
		{
			while(!B.empty()&&B.top()>=now)B.pop();
			if(!B.empty())now=B.top(),B.pop(),cnt++;
		}
		f=!f;
	}
	cout<<cnt<<endl;
}
0