結果
問題 |
No.1589 Bit Vector
|
ユーザー |
![]() |
提出日時 | 2021-07-08 23:02:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,537 bytes |
コンパイル時間 | 2,029 ms |
コンパイル使用メモリ | 184,884 KB |
実行使用メモリ | 6,816 KB |
最終ジャッジ日時 | 2024-07-01 13:06:38 |
合計ジャッジ時間 | 9,197 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 WA * 22 RE * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; int T; cin >> T; vector<vector<int>> C(T, vector<int>(N)); for (int i = 0; i < T; i++){ for (int j = 0; j < N; j++){ cin >> C[i][j]; } } vector<tuple<string, int, int, int>> op; for (int i = 0; i < T; i++){ vector<int> p; for (int j = 0; j < N; j++){ if (C[i][j] == 1){ p.push_back(j); } } if (p.size() >= K){ vector<bool> A(N, false); for (int j = 0; j < K; j++){ A[p[j]] = true; } op.push_back(make_tuple("UPD", N, 1, 0)); for (int j = 0; j < K; j++){ op.push_back(make_tuple("AND", N, p[j], N)); } op.push_back(make_tuple("XOR", N, p[0], N)); for (int j = 0; j < N; j++){ if (!A[j]){ op.push_back(make_tuple("XOR", j, p[0], j)); op.push_back(make_tuple("AND", j, N, N)); op.push_back(make_tuple("XOR", j, p[0], j)); } } op.push_back(make_tuple("XOR", N, p[0], N)); } } int cnt = op.size(); assert(cnt <= 10000); cout << cnt << endl; for (int i = 0; i < cnt; i++){ if (get<0>(op[i]) == "UPD"){ cout << "UPD " << get<1>(op[i]) << ' ' << get<2>(op[i]) << endl; } if (get<0>(op[i]) == "AND"){ cout << "AND " << get<1>(op[i]) << ' ' << get<2>(op[i]) << ' ' << get<3>(op[i]) << endl; } if (get<0>(op[i]) == "XOR"){ cout << "XOR " << get<1>(op[i]) << ' ' << get<2>(op[i]) << ' ' << get<3>(op[i]) << endl; } } }