結果

問題 No.110 しましまピラミッド
ユーザー moti
提出日時 2015-07-17 01:36:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 946 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 84,568 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-08 08:19:04
合計ジャッジ時間 1,314 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#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-1) { ans = max(ans, i+1-offset); }
    }
  }

  cout << ans << endl;

  return 0;
}
0