結果
問題 | No.1282 Display Elements |
ユーザー |
![]() |
提出日時 | 2020-11-06 22:03:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 723 bytes |
コンパイル時間 | 1,753 ms |
コンパイル使用メモリ | 177,280 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2024-07-22 12:49:31 |
合計ジャッジ時間 | 2,940 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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]){ v.push_back(*ms.begin()); ms.erase(*ms.begin()); } ans += v.size(); } cout << ans << endl; }