結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2020-05-14 22:33:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 714 bytes |
コンパイル時間 | 1,508 ms |
コンパイル使用メモリ | 171,464 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 03:29:15 |
合計ジャッジ時間 | 2,589 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)); }