結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | yukarinoki |
提出日時 | 2020-02-14 21:57:54 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 1,341 bytes |
コンパイル時間 | 937 ms |
コンパイル使用メモリ | 90,844 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-16 01:58:28 |
合計ジャッジ時間 | 2,012 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 36 ms
5,376 KB |
testcase_11 | AC | 37 ms
5,376 KB |
testcase_12 | AC | 41 ms
5,376 KB |
testcase_13 | AC | 20 ms
5,376 KB |
testcase_14 | AC | 57 ms
5,376 KB |
testcase_15 | AC | 17 ms
5,376 KB |
testcase_16 | AC | 30 ms
5,376 KB |
testcase_17 | AC | 20 ms
5,376 KB |
testcase_18 | AC | 23 ms
5,376 KB |
testcase_19 | AC | 35 ms
5,376 KB |
ソースコード
#include <iostream> #include <sstream> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <cmath> #include <tuple> #include <cassert> using namespace std; #define all(c) (c).begin(), (c).end() #define iter(c) __typeof((c).begin()) #define cpresent(c, e) (find(all(c), (e)) != (c).end()) #define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i) #define pb(e) push_back(e) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define mp(a,b) make_pair((a), (b)) #define mt(a,b,c) make_tuple((a),(b),(c)) typedef long long ll; int main(){ long long int n,m,k; cin >> n >> m >> k; string s; cin >> s; vector<long long int> v(m); rep(i,m) cin >> v[i]; vector<long long int> a(n); rep(i,n) cin >> a[i]; sort(all(a)); long long int ans = 0; if(s=="+") for(int i=0;i<m;i++){ int id = lower_bound(all(a), k-v[i]) - a.begin(); ans = ans + n-id; } else for(int i=0;i<m;i++){ int id; if(k % v[i] == 0) id = lower_bound(all(a), k/v[i]) - a.begin(); else id = lower_bound(all(a), k/v[i] + 1) - a.begin(); ans = ans + n-id; } cout << ans << endl; return 0; }