結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2015-04-21 15:49:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 668 bytes |
コンパイル時間 | 1,762 ms |
コンパイル使用メモリ | 164,724 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 19:07:22 |
合計ジャッジ時間 | 2,409 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 21 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:22:38: warning: narrowing conversion of ‘i’ from ‘int’ to ‘bool’ [-Wnarrowing] 22 | query.push_back((Query){Digit, i}); | ^
ソースコード
#include <bits/stdc++.h> using namespace std; struct Query { int length; bool 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 = -1, 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; } } cout << height << endl; }