結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー | charhan |
提出日時 | 2020-09-11 21:51:12 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,430 bytes |
コンパイル時間 | 1,419 ms |
コンパイル使用メモリ | 128,864 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-27 13:58:45 |
合計ジャッジ時間 | 2,636 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,380 KB |
testcase_18 | AC | 2 ms
4,384 KB |
testcase_19 | AC | 2 ms
4,380 KB |
testcase_20 | AC | 1 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,380 KB |
testcase_22 | AC | 1 ms
4,376 KB |
testcase_23 | AC | 2 ms
4,376 KB |
testcase_24 | AC | 1 ms
4,380 KB |
testcase_25 | AC | 2 ms
4,376 KB |
testcase_26 | AC | 1 ms
4,376 KB |
testcase_27 | AC | 2 ms
4,380 KB |
testcase_28 | AC | 2 ms
4,380 KB |
testcase_29 | AC | 1 ms
4,380 KB |
testcase_30 | AC | 2 ms
4,380 KB |
testcase_31 | AC | 1 ms
4,380 KB |
testcase_32 | AC | 1 ms
4,376 KB |
testcase_33 | AC | 2 ms
4,380 KB |
testcase_34 | AC | 2 ms
4,380 KB |
testcase_35 | AC | 2 ms
4,376 KB |
testcase_36 | AC | 2 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <map> #include <set> #include <string> #include <utility> #include <algorithm> #include <cstdio> #include <iomanip> #include <queue> #include <deque> #include <stack> #include <fstream> #include <cmath> #include <random> #include <complex> #include <functional> #include <bitset> #include <sstream> #include <cassert> #include <time.h> #define ll int64_t #define Rep(i, n) for (ll i = 0; i < n; i++) using namespace std; typedef vector<ll> vec; typedef vector<vec> mat; const ll inf = 1LL << 60; template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } } template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } } void printvec (vec &v) { Rep (i, (ll)v.size()) { cout << v[i] << " \n"[i+1 == (ll)v.size()]; } } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; vec S(N), T(N); Rep (i, N) cin >> S[i]; Rep (i, N) cin >> T[i]; ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0; Rep (i, N) { if (S[i] == 0) a++; if (S[i] == 1) b++; if (S[i] == 2) c++; if (T[i] == 0) d++; if (T[i] == 1) e++; if (T[i] == 2) f++; } ll ans = b*f + c*e + c*f; if (f == 0 and c == 0) ans += max(b, e); else if (f == 0 and c != 0) ans += b; else if (f != 0 and c == 0) ans += e; cout << ans << "\n"; }