結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2020-11-18 16:43:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 714 bytes |
コンパイル時間 | 1,637 ms |
コンパイル使用メモリ | 172,292 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 09:06:09 |
合計ジャッジ時間 | 2,672 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; int solve(priority_queue<int> now, priority_queue<int> nxt) { int ret = 0, len = 1000; while (true) { while (!now.empty() && now.top() >= len) { now.pop(); } if (now.empty()) break; ret++; len = now.top(); now.pop(); swap(now, nxt); } return ret; } int main() { int Nw, Nb; priority_queue<int> B, W; cin >> Nw; for (int i = 0; i < Nw; i++) { int a; cin >> a; W.push(a); } cin >> Nb; for (int i = 0; i < Nb; i++) { int a; cin >> a; B.push(a); } cout << max(solve(B, W), solve(W, B)); }