結果

問題 No.1282 Display Elements
ユーザー platinum
提出日時 2020-08-22 18:41:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 524 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 173,168 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-11-29 06:13:24
合計ジャッジ時間 29,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;

int main(){
    int N;
    cin >> N;
    vector<int> a(N), b(N);
    rep(i,N) cin >> a[i];
    rep(i,N) cin >> b[i];
    sort(a.begin(),a.end());
    vector<int> c;
    LL ans=0;
    rep(i,N){
        c.emplace_back(b[i]);
        sort(c.begin(),c.end());
        LL res=lower_bound(c.begin(),c.end(),a[i])-c.begin();
        ans+=res;
    }
    cout << ans << endl;

    return 0;
}
0