結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | MarcusAureliusAntoninus |
提出日時 | 2020-02-14 21:42:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 2,620 ms |
コンパイル使用メモリ | 197,684 KB |
最終ジャッジ日時 | 2025-01-09 00:06:36 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 3 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 3 ms
5,248 KB |
testcase_10 | AC | 24 ms
5,248 KB |
testcase_11 | AC | 23 ms
5,248 KB |
testcase_12 | AC | 29 ms
5,248 KB |
testcase_13 | AC | 17 ms
5,248 KB |
testcase_14 | AC | 40 ms
5,248 KB |
testcase_15 | AC | 12 ms
5,248 KB |
testcase_16 | AC | 22 ms
5,248 KB |
testcase_17 | AC | 17 ms
5,248 KB |
testcase_18 | AC | 15 ms
5,248 KB |
testcase_19 | AC | 25 ms
5,248 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:23: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 4 has type ‘int64_t*’ {aka ‘long int*’} [-Wformat=] 8 | scanf("%d%d%lld %c", &N, &M, &K, &op); | ~~~^ ~~ | | | | long long int* int64_t* {aka long int*} | %ld main.cpp:11:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘long int*’ [-Wformat=] 11 | scanf("%lld", &e); | ~~~^ ~~ | | | | | long int* | long long int* | %ld main.cpp:13:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘long int*’ [-Wformat=] 13 | scanf("%lld", &e); | ~~~^ ~~ | | | | | long int* | long long int* | %ld main.cpp:33:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=] 33 | printf("%lld\n", ans); | ~~~^ ~~~ | | | | | int64_t {aka long int} | long long int | %ld main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%d%lld %c", &N, &M, &K, &op); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared wit
ソースコード
#include <bits/stdc++.h>int main(){int N, M;int64_t K;char op;scanf("%d%d%lld %c", &N, &M, &K, &op);std::vector<int64_t> A(N), B(M);for (auto& e: B)scanf("%lld", &e);for (auto& e: A)scanf("%lld", &e);std::sort(A.begin(), A.end());std::sort(B.begin(), B.end());B.push_back(1'000'000'000);auto calc{[&](int64_t a, int64_t b){if (op == '+') return a + b;else return a * b;}};int64_t ans{};int ok{M};for (auto& e: A){while (ok > 0 && calc(e, B[ok - 1]) >= K)ok--;ans += M - ok;}printf("%lld\n", ans);return 0;}