結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
Konton7
|
| 提出日時 | 2020-02-22 19:57:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,048 bytes |
| コンパイル時間 | 2,453 ms |
| コンパイル使用メモリ | 199,520 KB |
| 最終ジャッジ日時 | 2025-01-09 01:55:00 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 9 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:48:16: warning: ‘d’ may be used uninitialized [-Wmaybe-uninitialized]
48 | ans += d;
| ^
main.cpp:32:9: note: ‘d’ was declared here
32 | int d;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int mod = 1e9 + 7;
ll cal(ll r, ll c, char op)
{
if (op == '*')
return r * c;
if (op == '+')
return r + c;
return 0;
}
int main()
{
#ifdef DEBUG
cout << "DEBUG MODE" << endl;
ifstream in("input.txt"); //for debug
cin.rdbuf(in.rdbuf()); //for debug
#endif
ll h, w, k, x;
int d;
ll ans = 0;
char op;
cin >> h >> w >> k >> op;
vector<ll> c(w), r(h);
rep(i, w) cin >> c[i];
rep(i, h) cin >> r[i];
sort(c.begin(), c.end());
rep(i, h)
{
if (op == '+')
d = c.cend() -upper_bound(c.cbegin(), c.cend(), k - r[i]);
if (op == '*')
d = c.cend() -upper_bound(c.cbegin(), c.cend(), k / r[i]);
ans += d;
}
cout << ans << endl;
return 0;
}
Konton7