結果
| 問題 |
No.1282 Display Elements
|
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2020-11-06 22:04:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 728 bytes |
| コンパイル時間 | 1,976 ms |
| コンパイル使用メモリ | 178,160 KB |
| 実行使用メモリ | 9,472 KB |
| 最終ジャッジ日時 | 2024-07-22 12:50:31 |
| 合計ジャッジ時間 | 3,231 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 += (ll) v.size();
}
cout << ans << endl;
}
misora192