結果

問題 No.989 N×Mマス計算(K以上)
ユーザー Konton7Konton7
提出日時 2020-02-22 19:57:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 2,223 ms
コンパイル使用メモリ 200,580 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 03:02:50
合計ジャッジ時間 2,952 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 31 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 20 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 14 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |         ^

ソースコード

diff #

#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;
}
0