結果
問題 | No.1282 Display Elements |
ユーザー |
![]() |
提出日時 | 2020-11-06 22:53:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 97 ms / 2,000 ms |
コード長 | 545 bytes |
コンパイル時間 | 1,449 ms |
コンパイル使用メモリ | 171,256 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-22 13:28:04 |
合計ジャッジ時間 | 3,025 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2020.11.06 22:53:19 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; vector<int> a(n),b(n); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } sort(a.begin(), a.end()); ll ans = 0; for (int i = 0; i < n; i++) { ans += min(n-i,(int)(a.end() - upper_bound(a.begin(), a.end(), b[i]))); } cout << ans << endl; return 0; }