結果
問題 | No.990 N×Mマス計算(Kの倍数) |
ユーザー | trineutron |
提出日時 | 2020-02-14 21:56:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 831 bytes |
コンパイル時間 | 2,299 ms |
コンパイル使用メモリ | 206,952 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-27 19:36:32 |
合計ジャッジ時間 | 3,205 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | RE | - |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 33 ms
6,940 KB |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | AC | 51 ms
6,940 KB |
testcase_15 | AC | 29 ms
6,940 KB |
testcase_16 | AC | 41 ms
6,940 KB |
testcase_17 | AC | 23 ms
6,944 KB |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 93 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, m, k; cin >> n >> m >> k; char op; cin >> op; vector<int64_t> a(n), b(m); for (int i = 0; i < m; i++) { cin >> b.at(i); b.at(i) %= k; } for (int i = 0; i < n; i++) { cin >> a.at(i); a.at(i) %= k; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if (op == '+') { int64_t ans = (upper_bound(a.begin(), a.end(), 0) - lower_bound(a.begin(), a.end(), 0)) * (upper_bound(b.begin(), b.end(), 0) - lower_bound(b.begin(), b.end(), 0)); for (int i = 0; i < n; i++) { ans += upper_bound(b.begin(), b.end(), k - a.at(i)) - lower_bound(b.begin(), b.end(), k - a.at(i)); } cout << ans << endl; } else { return 1; } }