結果
| 問題 |
No.989 N×Mマス計算(K以上)
|
| コンテスト | |
| ユーザー |
Konton7
|
| 提出日時 | 2020-02-22 19:51:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,049 bytes |
| コンパイル時間 | 2,500 ms |
| コンパイル使用メモリ | 197,916 KB |
| 最終ジャッジ日時 | 2025-01-09 01:54:49 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:49:16: warning: ‘d’ may be used uninitialized [-Wmaybe-uninitialized]
49 | ans += d;
| ^
main.cpp:33:9: note: ‘d’ was declared here
33 | 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() -lower_bound(c.cbegin(), c.cend(), k - r[i]);
if (op == '*')
d = c.cend() -lower_bound(c.cbegin(), c.cend(), k / r[i]);
ans += d;
}
cout << ans << endl;
return 0;
}
Konton7