結果
問題 |
No.989 N×Mマス計算(K以上)
|
ユーザー |
![]() |
提出日時 | 2025-07-01 00:19:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 643 bytes |
コンパイル時間 | 3,580 ms |
コンパイル使用メモリ | 281,704 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-07-01 00:20:02 |
合計ジャッジ時間 | 4,661 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); ll n, m, k; cin >> n >> m >> k; char op; cin >> op; vector<ll> a(n), b(m); rep(i, m) cin >> b[i]; rep(i, n) cin >> a[i]; sort(b.begin(), b.end()); ll ans = 0; rep(i, n) { auto it = lower_bound(b.begin(), b.end(), op == '+' ? k - a[i] : (k + a[i] - 1) / a[i]); ans += b.end() - it; } cout << ans << '\n'; return 0; }