結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー | Flkanjin |
提出日時 | 2020-03-15 15:04:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,994 bytes |
コンパイル時間 | 1,067 ms |
コンパイル使用メモリ | 119,072 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 07:36:24 |
合計ジャッジ時間 | 2,281 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 27 ms
6,940 KB |
testcase_14 | WA | - |
testcase_15 | AC | 22 ms
6,944 KB |
testcase_16 | AC | 47 ms
6,940 KB |
testcase_17 | AC | 59 ms
6,940 KB |
testcase_18 | AC | 35 ms
6,940 KB |
testcase_19 | AC | 54 ms
6,940 KB |
testcase_20 | AC | 80 ms
6,944 KB |
ソースコード
#define _USE_MATH_DEFINES#include <algorithm>#include <bitset>#include <cassert>#include <cctype>#include <clocale>#include <cmath>#include <cstdio>#include <cstdlib>#include <ctime>#include <deque>#include <fstream>#include <functional>#include <iomanip>#include <iostream>#include <iterator>#include <list>#include <map>#include <queue>#include <regex>#include <set>#include <sstream>#include <stack>#include <string>#include <tuple>#include <unordered_map>#include <unordered_set>#include <utility>#include <vector>using namespace std;#define IOS ios::sync_with_stdio(false); cin.tie(0);#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)#define REP(i, n) FOR(i, 0, n)#define REPS(i, n) FORS(i, 0, n)#define VREP(i, n) VFOR(i, 0, n)#define VREPS(i, n) VFORS(i, 0, n)#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)#define RREP(i, n) RFOR(i, n, 0)#define RREPS(i, n) RFORS(i, n, 0)#define ALL(v) (v).begin(), (v).end()#define SORT(v) sort(ALL(v))#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())#define SZ(x) ((int)(x).size())#define REV(x) reverse(ALL(x))#define PB push_back#define EB emplace_back#define MP make_pair#define MT make_tuple#define BIT(n) (1LL<<(n))#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())using ld = long double;using ll = long long;using ui = unsigned int;using ull = unsigned long long;using Pi_i = pair<int, int>;using Pll_ll = pair<ll, ll>;using VB = vector<bool>;using VC = vector<char>;using VD = vector<double>;using VI = vector<int>;using VLL = vector<ll>;using VS = vector<string>;using VSH = vector<short>;using VULL = vector<ull>;const int MOD = 1000000007;const int INF = 1000000000;const int NIL = -1;const double EPS = 1E-10;template<class T, class S>bool chmax(T &a, const S &b){if(a < b){a = b; return true;}return false;}template<class T, class S>bool chmin(T &a, const S &b){if(b < a){a = b; return true;}return false;}int main(){int N, M, K; cin >> N >> M >> K;char op; cin >> op;ll ans = 0;VLL A(N), B(M);REP(j, M) cin >> B[j];REP(i, N) cin >> A[i];if(op == '+'){REP(i, N){ans = (ans + M*A[i]) % K;if(ans < 0) ans += K;}REP(j, M){ans = (ans + N*B[j]) % K;if(ans < 0) ans += K;}}else{ll a = 0, b = 0;REP(i, N){a = (a + A[i]) % K;if(a < 0) a += K;}REP(j, M){b = (b + B[j]) & K;if(b < 0) b += K;}ans = a * b % K;if(ans < 0) ans += K;}cout << ans << endl;return 0;}