結果
| 問題 | No.1282 Display Elements | 
| コンテスト | |
| ユーザー |  misora192 | 
| 提出日時 | 2020-11-06 21:58:40 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 655 bytes | 
| コンパイル時間 | 1,507 ms | 
| コンパイル使用メモリ | 174,984 KB | 
| 実行使用メモリ | 11,904 KB | 
| 最終ジャッジ日時 | 2024-07-22 12:46:58 | 
| 合計ジャッジ時間 | 5,278 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 TLE * 1 -- * 8 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	sort(a.begin(), a.end());
	multiset<ll> ms;
	ll ans = 0;
	rep(i, n){
		ms.insert(b[i]);
		auto it = ms.lower_bound(a[i]);
		ans += distance(ms.begin(), it);
	}
	
	cout << ans << endl;
}	
            
            
            
        