結果
問題 | No.2308 [Cherry 5th Tune B] もしかして、真? |
ユーザー | kabipoyo |
提出日時 | 2023-05-19 22:09:14 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,124 bytes |
コンパイル時間 | 4,559 ms |
コンパイル使用メモリ | 266,808 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-05-10 05:38:12 |
合計ジャッジ時間 | 9,001 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | TLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; typedef int64_t lint; #define rep(i, n) for(int i=0; i<n; i++) #define repx(i, l, n) for(int i=l; i<n; i++) #define all(v) v.begin(), v.end() #define show(x) cout << #x << ": " << x << endl; #define list(x) cout << #x << ": " << x << " "; #define pb push_back using vi = vector<lint>; using vvi = vector<vector<lint>>; template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T> inline void drop(T x) { cout << x << endl; exit(0); } template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; } constexpr lint LINF = LLONG_MAX/2; int main() { lint T; cin >> T; rep(_, T) { lint N; cin >> N; vector<string> v(N), w(N-1); vi Q(N-1); vin(v); vin(w); vin(Q); lint a=0, b=0, c=0, x, y, z; fenwick_tree<lint> fw(N-1); rep(i, N-1) fw.add(i, 1); rep(i, N-1) { lint ng = -1, mid, ok = N-1; while (abs(ok - ng) > 1) { mid = (ok + ng) / 2; x = fw.sum(0, mid+1); if (x >= Q[i]) ok = mid; else ng = mid; } Q[i] = ok; if (w[Q[i]] == "and") { if (v[Q[i]] == "False" || v[Q[i+1]] == "False") { v[Q[i]] = "False"; v[Q[i+1]] = "False"; } else { v[Q[i]] = "True"; v[Q[i+1]] = "True"; } } else if (w[Q[i]] == "or") { if (v[Q[i]] == "True" || v[Q[i+1]] == "True") { v[Q[i]] = "True"; v[Q[i+1]] = "True"; } else { v[Q[i]] = "False"; v[Q[i+1]] = "False"; } } else if (w[Q[i]] == "xor") { if (v[Q[i]] != v[Q[i+1]]) { v[Q[i]] = "True"; v[Q[i+1]] = "True"; } else { v[Q[i]] = "False"; v[Q[i+1]] = "False"; } } else if (w[Q[i]] == "imp") { if (v[Q[i]] == "True") { v[Q[i]] = v[Q[i+1]]; } else { v[Q[i]] = "True"; v[Q[i+1]] = "True"; } } fw.add(Q[i], -1); } cout << v[0] << endl; } }