結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-16 02:40:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 611 bytes |
| コンパイル時間 | 2,070 ms |
| コンパイル使用メモリ | 198,568 KB |
| 最終ジャッジ日時 | 2025-01-09 00:52:06 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
int main(){
int N, M, K; std::cin >> N >> M >> K;
char op; std::cin >> op;
std::vector<int64_t> A(N), B(M);
for(int i = 0; i < M; ++i) std::cin >> B[i];
for(int i = 0; i < N; ++i) std::cin >> A[i];
std::sort(A.begin(), A.end());
std::sort(B.begin(), B.end());
int64_t ans = 0;
if(op == '+'){
for(auto x : A){
ans += M - (std::lower_bound(B.begin(), B.end(), K-x) - B.begin());
}
}else{
for(auto x : A){
ans += M - (std::lower_bound(B.begin(), B.end(), (K+x-1)/x) - B.begin());
}
}
std::cout << ans << std::endl;
return 0;
}