結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2015-07-17 01:37:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 953 bytes |
| コンパイル時間 | 934 ms |
| コンパイル使用メモリ | 85,748 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 11:11:20 |
| 合計ジャッジ時間 | 1,599 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
int main() {
int x;
vector<int> block[2];
int nw; cin >> nw;
rep(i, nw) { cin >> x; block[0].push_back(x); }
int nb; cin >> nb;
rep(i, nb) { cin >> x; block[1].push_back(x); }
sort(block[0].begin(), block[0].end());
sort(block[1].begin(), block[1].end());
int ans = 0;
rep(offset, 2) {
int pre = 0;
for(int i=offset; i<nb+nw + offset; i++) {
bool ok = false;
auto const& tar = block[i&1];
rep(j, tar.size()) {
if(pre < tar[j]) { pre = tar[j]; ok = true; break; }
}
if(!ok) { ans = max(ans, i-offset); break; }
if(i == nb+nw+offset-1) { ans = max(ans, i+1-offset); }
}
}
cout << ans << endl;
return 0;
}
moti