結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2015-04-21 15:54:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 909 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 164,996 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 11:08:12 |
合計ジャッジ時間 | 2,646 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; struct Query { int length, type; bool operator<(const Query& q) const { return(length < q.length); } }; int main() { vector< Query > query; for(int i = 0; i < 2; i++) { int N; cin >> N; while(N--) { int Digit; cin >> Digit; query.push_back((Query){Digit, i}); } } sort(query.rbegin(), query.rend()); int height = 0, type = 0, length = 1 << 30; for(int i = 0; i < query.size(); i++) { Query& q = query[i]; if(type != q.type && length > q.length) { height++; type = q.type; length = q.length; } } int height2 = 0; type = 1, length = 1 << 30; for(int i = 0; i < query.size(); i++) { Query& q = query[i]; if(type != q.type && length > q.length) { height2++; type = q.type; length = q.length; } } cout << max(height, height2) << endl; }