結果

問題 No.110 しましまピラミッド
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2024-01-02 15:54:17
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 1,424 bytes
コンパイル時間 5,700 ms
コンパイル使用メモリ 315,548 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-02 15:54:25
合計ジャッジ時間 7,464 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k))
#define rrep(i,m,n,k) for (int i = (int)(m); i > (int)(n); i += (int)(k))
#define ll long long
#define list(T,A,N) vector<T> A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];}
long long  power_mod(long long n, long long k, long long mod) {
    long  result = 1;
    // k を右シフトしつつ n を 2 乗していく
    while (k > 0) {
        // k の最下ビットが 1 なら、今の n を答えに掛ける
        if ((k & 1) == 1) result = (result * n) % mod;
        n = n * n % mod;
        k >>= 1;
    }
    return result;
}
template <class T>
map<T,ll> Counter(vector<T> A){
    map<T,ll> m;
    for(auto a:A) m[a]++;
    return m;
} 

int main(){
    ll N,M;
    cin >> N;
    list(ll,W,N);
    cin >> M;
    list(ll,B,M);
    vector<pair<ll,ll>> X;
    rep(i,0,N,1){
        X.push_back({W[i],0});
    }
    rep(i,0,M,1){
        X.push_back({B[i],1});
    }
    sort(X.begin(),X.end());
    vector<ll> ans(N+M,1);
    rep(i,1,N+M,1){
        auto [l,x] = X[i];
        rep(j,0,i,1){
            auto [val,y] = X[j];
            if (x!=y){
                if (val!=l){
                    ans[i] = max(ans[i],ans[j]+1);
                }
            }
        }
    }
    cout << *max_element(ans.begin(),ans.end()) << endl;
    return 0;
}
0