結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| ユーザー |
heno239
|
| 提出日時 | 2020-02-15 03:30:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 1,304 bytes |
| コンパイル時間 | 1,198 ms |
| コンパイル使用メモリ | 112,456 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 13:39:40 |
| 合計ジャッジ時間 | 2,235 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<cassert>
#include<random>
#include<unordered_map>
#include<numeric>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa;cin>>nyaa;
using P = pair<int, int>;
using LP = pair<ll, ll>;
int h, w;
ll x;
ll a[1 << 17], b[1 << 17];
void solvep() {
sort(b, b + w);
ll ans = 0;
rep(i, h) {
ans += b+w - lower_bound(b, b + w, x - a[i]);
}
cout << ans << endl;
}
void solvem() {
sort(b, b + w);
ll ans = 0;
rep(i, h) {
ll inf = (x + a[i] - 1) / a[i];
ans += b + w - lower_bound(b, b + w, inf);
}
cout << ans << endl;
}
void solve() {
cin >> h >> w>>x;
char c; cin >> c;
rep(j, w)cin >> b[j]; rep(i, h)cin >> a[i];
if (c == '+') {
solvep();
}
else {
solvem();
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
//int t; cin >> t;rep(i,t) solve();
solve();
stop
return 0;
}
heno239