結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | kenken714 |
提出日時 | 2020-02-14 22:41:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 1,106 bytes |
コンパイル時間 | 1,048 ms |
コンパイル使用メモリ | 95,128 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 12:59:44 |
合計ジャッジ時間 | 1,837 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <iostream> #include <string> #include <cstring> #include <utility> #include <algorithm> #include <map> #include <set> #include <vector> #include <cmath> #include <cstdlib> #include <queue> #include <stack> #include <iomanip> #include <fstream> #include <unordered_set> using namespace std; #define REP(i, n) for(ll i = 0;i < n;i++) #define REPR(i, n) for(ll i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(ll i = 1;i <= n;i++) #define ll long long #define INF (ll)1 << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(),n.end() #define MOD 1000000007 #define P pair<ll, ll> ll n, m, k, as, bs; char c; int main() { cin >> n >> m >> k >> c; vector<ll> a(n), b(m); REP(i, m) { cin >> b[i]; bs += b[i]; } REP(i, n) { cin >> a[i]; as += a[i]; } sort(ALL(a)); a.push_back(INF); ll ans = 0; REP(i, m) { ll now; if (c == '+') now = k - b[i]; else now = (k + b[i] - 1) / b[i]; ll it = a.end() - lower_bound(ALL(a), now) - 1; //cout << it <<endl; ans += it; } cout << ans << endl; }