結果
| 問題 |
No.1282 Display Elements
|
| コンテスト | |
| ユーザー |
niboshi_wakai
|
| 提出日時 | 2020-11-06 22:25:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,380 bytes |
| コンパイル時間 | 1,770 ms |
| コンパイル使用メモリ | 174,516 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-07-22 13:10:03 |
| 合計ジャッジ時間 | 5,513 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 TLE * 1 -- * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b) for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n) For(i, 0, n)
#define debug(x) cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
//Write From this Line
const int dy[] = {0,0,1,-1};
const int dx[] = {1,-1,0,0};
//const ll mod = 1e9+7;
//const ll mod = 998244353;
const double PI=3.14159265358979323846;
const int INF = 1001001001;
int main()
{
int n;
cin >> n;
vector<int> a(n);
rep(i, n)cin>>a[i];
vector<int> b(n);
rep(i, n)cin>>b[i];
// a君は,勝つことが出来るものの内最小のものを出せばいい.
SORT(a);
int ans = 0;
// bは順番が決まっている.
multiset<int> s;
rep(i,n){
s.insert(b[i]);
auto it = s.lower_bound(a[i]);
int length = distance(s.begin(),it);
//auto it = lower_bound(s.begin(),s.end(),a[i]);
//int ind = (it - s.begin());
//debug(ind);
ans += length;
}
cout << ans << endl;
}
niboshi_wakai