結果

問題 No.1282 Display Elements
ユーザー zuminzumin
提出日時 2021-03-24 00:00:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 478 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 79,004 KB
実行使用メモリ 9,584 KB
最終ジャッジ日時 2023-08-17 11:20:55
合計ジャッジ時間 5,846 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <set>
#include <queue>

using namespace std;

int main(){
    multiset<int> b;
    priority_queue<int,vector<int>,greater<int>> a;
    int n,ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int ai;
        cin>>ai;
        a.push(ai);
    }
    while(a.size()){
        int ai=a.top();a.pop();
        int bi;
        cin>>bi;
        b.insert(bi);
        ans+=distance(b.begin(),b.lower_bound(ai));
    }
    cout<<ans<<endl;

    return 0;
}
0