結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-14 23:06:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 845 bytes |
| コンパイル時間 | 2,245 ms |
| コンパイル使用メモリ | 198,744 KB |
| 最終ジャッジ日時 | 2025-01-09 00:30:22 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(0); ios::sync_with_stdio(0);
ll n, m, k;
cin >> n >> m >> k;
string op; cin >> op;
vector<ll> a(n), b(m);
for(int i = 0; i < m; ++i) cin >> b[i];
for(int i = 0; i < n; ++i) cin >> a[i];
sort(b.begin(), b.end());
ll ans = 0;
if(op == "+"){
for(int i = 0; i < n; ++i){
ll x = k-a[i];
ll cnt = lower_bound(b.begin(), b.end(), x)-b.begin();
cnt = m-cnt;
ans += cnt;
}
}else{
for(int i = 0; i < n; ++i){
ll x = (k+a[i]-1)/a[i];
ll cnt = lower_bound(b.begin(), b.end(), x)-b.begin();
cnt = m-cnt;
ans += cnt;
}
}
cout << ans << '\n';
return 0;
}