結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2015-04-21 15:48:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 661 bytes |
コンパイル時間 | 1,528 ms |
コンパイル使用メモリ | 163,036 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 19:07:24 |
合計ジャッジ時間 | 2,048 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 WA * 3 |
コンパイルメッセージ
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.begin(), query.end()); int height = 0, type = -1, length = -1; 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; }