結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー | kinsei0916 |
提出日時 | 2020-02-15 00:44:20 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 2,206 bytes |
コンパイル時間 | 1,675 ms |
コンパイル使用メモリ | 203,140 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 07:21:55 |
合計ジャッジ時間 | 2,547 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 7 ms
5,376 KB |
testcase_11 | AC | 10 ms
5,376 KB |
testcase_12 | AC | 16 ms
5,376 KB |
testcase_13 | AC | 8 ms
5,376 KB |
testcase_14 | AC | 8 ms
5,376 KB |
testcase_15 | AC | 7 ms
5,376 KB |
testcase_16 | AC | 13 ms
5,376 KB |
testcase_17 | AC | 16 ms
5,376 KB |
testcase_18 | AC | 10 ms
5,376 KB |
testcase_19 | AC | 15 ms
5,376 KB |
testcase_20 | AC | 22 ms
5,376 KB |
コンパイルメッセージ
main.cpp: In function 'std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)': main.cpp:36:7: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 36 | rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; | ^ main.cpp:6:48: note: in definition of macro '_rep3' 6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++) | ^ main.cpp:10:43: note: in expansion of macro '_rep2' 10 | #define _overload3(_1, _2, _3, name, ...) name | ^~~~ main.cpp:36:3: note: in expansion of macro 'rep' 36 | rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; | ^~~ main.cpp:36:7: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 36 | rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; | ^ main.cpp:6:61: note: in definition of macro '_rep3' 6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++) | ^ main.cpp:10:43: note: in expansion of macro '_rep2' 10 | #define _overload3(_1, _2, _3, name, ...) name | ^~~~ main.cpp:36:3: note: in expansion of macro 'rep' 36 | rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; | ^~~ main.cpp: In function 'int main()': main.cpp:83:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 83 | rep(i, N) ans += A[i]; | ^ main.cpp:6:48: note: in definition of macro '_rep3' 6 | #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++) | ^ main.cpp:10:43: note: in expansion of macro '_rep2' 10 | #define _overload3(_1, _2, _3, name, ..
ソースコード
#pragma region #include "bits/stdc++.h" #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++) #define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--) #define _rep2(i, n) _rep3(i, 0, n) #define _irep2(i, n) _irep3(i, 0, n) #define _overload3(_1, _2, _3, name, ...) name #define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__) #define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__) #define out(x) cout << (x) << '\n'; #define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl; using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<long long>; using vvi = vector<vector<int>>; using vvl = vector<vector<long long>>; template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &pair) { cin >> pair.first >> pair.second; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "[ "; rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; os << " ]"; return os; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } void init() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(16) << boolalpha; } #pragma endregion #define MOD 1000000007 #define INF 2147483647 int main() { init(); int N, M; ll K; cin >> N >> M >> K; char op; vl A(N), B(M); cin >> op >> B >> A; ll ans = 0; if (op == '+') { rep(i, N) ans += A[i]; ans %= K; ans *= M; ans %= K; ll t = 0; rep(i, M) t += B[i]; t %= K; t *= N; t %= K; ans = (ans + t) % K; } else { rep(i, N) ans += A[i]; ans %= K; ll t = 0; rep(i, M) t += B[i]; t %= K; ans = (ans * t) % K; } out(ans); }