結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
lotus
|
| 提出日時 | 2020-03-12 16:52:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 2,276 ms |
| コンパイル使用メモリ | 171,332 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 15:07:29 |
| 合計ジャッジ時間 | 3,065 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define LINF (1LL << 60)
typedef long long i64;
typedef pair<i64,i64> P;
inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }
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 (b<a) { a=b; return 1; } return 0; }
int n,m,k, a[101010], b[101010];
char c;
void solve(){
cin >> n >> m >> k;
cin >> c;
for(int i = 0; i < m; i++){
cin >> b[i];
}
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a,a+n); sort(b,b+m);
i64 cnt = 0;
a[n] = b[m] = INF;
for(int i = 0; i < n; i++){
if(c == '+'){
cnt += m-(lower_bound(b,b+m,k-a[i])-b);
}
else{
cnt += m-(lower_bound(b,b+m+1,(k+a[i]-1)/a[i])-b);
}
}
cout << cnt << endl;
}
int main(){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
int t = 1;
//cin >> t;
while(t--){
solve();
}
return 0;
}
lotus