結果

問題 No.988 N×Mマス計算(総和)
ユーザー cotton_fn_cotton_fn_
提出日時 2020-02-15 01:41:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 979 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 113,280 KB
実行使用メモリ 4,664 KB
最終ジャッジ日時 2023-09-20 12:02:57
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 23 ms
4,380 KB
testcase_11 AC 35 ms
4,380 KB
testcase_12 AC 58 ms
4,608 KB
testcase_13 AC 28 ms
4,376 KB
testcase_14 AC 26 ms
4,376 KB
testcase_15 AC 23 ms
4,376 KB
testcase_16 AC 47 ms
4,380 KB
testcase_17 AC 59 ms
4,380 KB
testcase_18 AC 33 ms
4,380 KB
testcase_19 AC 54 ms
4,376 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    i64 n, m, k;
    char op;
    cin >> n >> m >> k >> op;
    vector<i64> a(n), b(m);
    for (int i = 0; i < m; ++i) cin >> b[i];
    for (int i = 0; i < n; ++i) cin >> a[i];

    i64 ans = 0;
    if (op == '+') {
        for (int i = 0; i < n; ++i) ans += m * a[i];
        for (int i = 0; i < m; ++i) ans += n * b[i];
    } else {
        i64 x = 0, y = 0;
        for (int i = 0; i < n; ++i) x += a[i];
        for (int i = 0; i < m; ++i) y += b[i];
        ans = (x % k) * (y % k);
    }
    cout << ans % k << endl;
    return 0;
}
0