結果
| 問題 | 
                            No.1282 Display Elements
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-11-09 23:59:28 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 714 bytes | 
| コンパイル時間 | 1,825 ms | 
| コンパイル使用メモリ | 175,696 KB | 
| 実行使用メモリ | 13,888 KB | 
| 最終ジャッジ日時 | 2024-07-22 17:03:13 | 
| 合計ジャッジ時間 | 5,300 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 TLE * 1 -- * 8 | 
ソースコード
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) { cin >> A[i]; }
    rep(i, N) { cin >> B[i]; }
    sort(all(A));
    int sum = 0;
    multiset<ll> mul;
    mul.insert(-INF);
    mul.insert(INF);
    rep(i, N) {
        mul.insert(B[i]);
        int j = distance(mul.begin(), mul.lower_bound(A[i])) - 1;
        sum += j;
    }
    cout << sum << endl;
    return 0;
}