結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー |
![]() |
提出日時 | 2024-04-02 00:36:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 706 bytes |
コンパイル時間 | 3,208 ms |
コンパイル使用メモリ | 245,892 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 22:56:45 |
合計ジャッジ時間 | 4,085 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; #include <atcoder/modint> using mint = atcoder::dynamic_modint<1>; int main() { int n, m, k; cin >> n >> m >> k; mint::set_mod(k); char op; cin >> op; mint row = 0, col = 0; rep(i, m) { int x; cin >> x; row += x; } rep(i, n) { int x; cin >> x; col += x; } mint ans = 0; if (op == '+') { ans = n * row + m * col; } else { ans = row * col; } cout << ans.val() << endl; return 0; }