結果
| 問題 |
No.1282 Display Elements
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-11-06 22:02:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 2,000 ms |
| コード長 | 476 bytes |
| コンパイル時間 | 1,383 ms |
| コンパイル使用メモリ | 168,728 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 12:48:39 |
| 合計ジャッジ時間 | 2,926 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int N;
int A[100000];
int B[100000];
int main() {
cin >> N;
rep(i, N) cin >> A[i];
rep(i, N) cin >> B[i];
sort(A, A + N);
LL ans = 0;
rep(i, N) {
int l = i, r = N + 1;
while (l + 1 < r) {
int m = (l + r) / 2;
if (B[i] < A[m - 1]) r = m;
else l = m;
}
ans += N - l;
}
cout << ans << endl;
return 0;
}
Nachia