結果
問題 | No.1589 Bit Vector |
ユーザー | e869120 |
提出日時 | 2021-07-08 22:08:10 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 2,005 bytes |
コンパイル時間 | 765 ms |
コンパイル使用メモリ | 81,744 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 12:37:51 |
合計ジャッジ時間 | 2,850 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 3 ms
6,944 KB |
testcase_12 | AC | 3 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,948 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 3 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 3 ms
6,940 KB |
testcase_18 | AC | 2 ms
6,940 KB |
testcase_19 | AC | 2 ms
6,944 KB |
testcase_20 | AC | 14 ms
6,940 KB |
testcase_21 | AC | 14 ms
6,944 KB |
testcase_22 | AC | 13 ms
6,940 KB |
testcase_23 | AC | 13 ms
6,940 KB |
testcase_24 | AC | 13 ms
6,940 KB |
testcase_25 | AC | 13 ms
6,940 KB |
testcase_26 | AC | 13 ms
6,944 KB |
testcase_27 | AC | 13 ms
6,940 KB |
testcase_28 | AC | 14 ms
6,940 KB |
testcase_29 | AC | 13 ms
6,944 KB |
testcase_30 | AC | 13 ms
6,944 KB |
testcase_31 | AC | 13 ms
6,944 KB |
testcase_32 | AC | 14 ms
6,944 KB |
testcase_33 | AC | 13 ms
6,940 KB |
testcase_34 | AC | 14 ms
6,940 KB |
testcase_35 | AC | 2 ms
6,944 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <tuple> #include <cassert> using namespace std; int N, K, T; int B[1009], C[1009][1009]; vector<tuple<string, int, int, int>> Answer; void Solve(int px, int py) { Answer.push_back(make_tuple("UPD", N, 1, -1)); Answer.push_back(make_tuple("XOR", N, py, N)); Answer.push_back(make_tuple("AND", N, px, N)); Answer.push_back(make_tuple("XOR", px, px, N)); Answer.push_back(make_tuple("XOR", py, py, N)); } int main() { // Step #1. Input cin >> N >> K >> T; for (int i = 1; i <= T; i++) { for (int j = 0; j < N; j++) cin >> C[i][j]; } assert(2 <= N && N <= 50); assert(1 <= K && K <= N); assert(1 <= T && T <= 100); for (int i = 1; i <= T; i++) { for (int j = 0; j < N; j++) { assert(C[i][j] == 0 || C[i][j] == 1); } } // Step #2. Solve for (int i = N - 2; i >= 0; i--) { for (int j = 0; j <= i; j++) { Solve(j, j + 1); } } Answer.push_back(make_tuple("UPD", N, 0, -1)); Answer.push_back(make_tuple("XOR", N, N - K, N)); // Step #3. Output The Answer cout << Answer.size() << endl; for (int i = 0; i < Answer.size(); i++) { if (get<0>(Answer[i]) == "UPD") cout << get<0>(Answer[i]) << " " << get<1>(Answer[i]) << " " << get<2>(Answer[i]) << endl; if (get<0>(Answer[i]) == "AND") cout << get<0>(Answer[i]) << " " << get<1>(Answer[i]) << " " << get<2>(Answer[i]) << " " << get<3>(Answer[i]) << endl; if (get<0>(Answer[i]) == "XOR") cout << get<0>(Answer[i]) << " " << get<1>(Answer[i]) << " " << get<2>(Answer[i]) << " " << get<3>(Answer[i]) << endl; } /*for (int i = 1; i <= T; i++) { for (int j = 0; j < N; j++) B[j] = C[i][j]; B[N] = 0; for (int j = 0; j < Answer.size(); j++) { if (get<0>(Answer[j]) == "UPD") B[get<1>(Answer[j])] = get<2>(Answer[j]); if (get<0>(Answer[j]) == "AND") B[get<1>(Answer[j])] = (B[get<2>(Answer[j])] & B[get<3>(Answer[j])]); if (get<0>(Answer[j]) == "XOR") B[get<1>(Answer[j])] = (B[get<2>(Answer[j])] ^ B[get<3>(Answer[j])]); } }*/ return 0; }