結果
問題 | No.1282 Display Elements |
ユーザー |
![]() |
提出日時 | 2020-11-06 22:06:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 741 bytes |
コンパイル時間 | 1,763 ms |
コンパイル使用メモリ | 179,056 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2024-07-22 12:52:41 |
合計ジャッジ時間 | 3,165 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 5 |
ソースコード
#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;vector<ll> v;ll ans = 0;rep(i, n){ms.insert(b[i]);while(!ms.empty() && *ms.begin() < a[i]){ll t = *ms.begin();v.push_back(t);ms.erase(*ms.begin());}ans += (ll) v.size();}cout << ans << endl;}