結果

問題 No.988 N×Mマス計算(総和)
ユーザー outlineoutline
提出日時 2020-03-05 16:35:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,385 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 108,444 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-09-20 12:12:42
合計ジャッジ時間 2,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 9 ms
4,380 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 22 ms
4,432 KB
testcase_13 AC 11 ms
4,376 KB
testcase_14 AC 11 ms
4,380 KB
testcase_15 AC 9 ms
4,376 KB
testcase_16 AC 18 ms
4,376 KB
testcase_17 AC 22 ms
4,404 KB
testcase_18 AC 13 ms
4,380 KB
testcase_19 AC 21 ms
4,380 KB
testcase_20 AC 29 ms
4,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, k;
    char op;
    cin >> n >> m >> k >> op;
    vector<ll> b(m);
    ll bsum = 0;
    for(int i = 0; i < m; ++i){
        cin >> b[i];
        bsum = (bsum + b[i]) % k;
    }
    vector<ll> a(n);
    ll asum = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        asum = (asum + a[i]) % k;
    }
    ll res = 0;
    if(op == '+'){
        res = asum * m % k + bsum * n % k;
        res %= k;
    }
    else{
        res = asum * bsum % k;
    }
    cout << res << endl;
}
0