結果

問題 No.110 しましまピラミッド
ユーザー dnishdnish
提出日時 2018-06-18 13:53:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,447 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 170,584 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 04:04:37
合計ジャッジ時間 2,957 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 1 ms
4,384 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,384 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(int i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const int inf=1e9;

int Nw,Nb;

int main(){
    while(cin>>Nw) {
        vector<int> vt[2];
        REP(i, 0, Nw) {
            int w;
            cin >> w;
            vt[0].push_back(w);
        }
        cin >> Nb;
        REP(i, 0, Nb) {
            int b;
            cin >> b;
            vt[1].push_back(b);
        }
        sort(ALL(vt[0]));
        sort(ALL(vt[1]));
        int ans=0;
        REP(i,0,2){
            int mx=0;
            int len = inf;
            int col = i;
            int nw = Nw-1;
            int nb = Nb-1;
            while (!((col==0&&nw==-1)||(col&&nb==-1))){
                if(col==0){
                    if(vt[0][nw]<len){
                        len = vt[0][nw];
                        col=1;
                        mx++;
                    }
                    nw--;
                }else{
                    if(vt[1][nb]<len){
                        len = vt[1][nb];
                        col=0;
                        mx++;
                    }
                    nb--;
                }
            }
            ans = max(ans,mx);
        }
        p(ans);

    }
    return 0;
}
0