結果

問題 No.1355 AND OR GAME
ユーザー tarakojo1019tarakojo1019
提出日時 2021-01-18 11:08:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,465 bytes
コンパイル時間 3,539 ms
コンパイル使用メモリ 114,844 KB
実行使用メモリ 7,000 KB
最終ジャッジ日時 2023-08-20 18:41:51
合計ジャッジ時間 16,481 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,384 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,384 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 14 ms
4,380 KB
testcase_35 AC 123 ms
6,836 KB
testcase_36 AC 114 ms
6,600 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 123 ms
6,776 KB
testcase_39 AC 44 ms
4,380 KB
testcase_40 AC 60 ms
4,892 KB
testcase_41 AC 124 ms
6,916 KB
testcase_42 AC 123 ms
6,596 KB
testcase_43 AC 71 ms
4,376 KB
testcase_44 AC 19 ms
4,380 KB
testcase_45 AC 124 ms
6,936 KB
testcase_46 AC 49 ms
4,856 KB
testcase_47 AC 141 ms
6,776 KB
testcase_48 AC 93 ms
6,272 KB
testcase_49 AC 131 ms
6,748 KB
testcase_50 WA -
testcase_51 AC 67 ms
4,952 KB
testcase_52 AC 111 ms
6,480 KB
testcase_53 AC 77 ms
5,040 KB
testcase_54 AC 126 ms
6,600 KB
testcase_55 AC 109 ms
4,632 KB
testcase_56 AC 109 ms
4,840 KB
testcase_57 AC 86 ms
6,120 KB
testcase_58 AC 25 ms
4,380 KB
testcase_59 AC 1 ms
4,384 KB
testcase_60 AC 82 ms
6,136 KB
testcase_61 AC 1 ms
4,380 KB
testcase_62 AC 55 ms
4,380 KB
testcase_63 AC 125 ms
6,600 KB
testcase_64 AC 111 ms
4,844 KB
testcase_65 AC 2 ms
4,380 KB
testcase_66 AC 37 ms
4,376 KB
testcase_67 AC 40 ms
4,376 KB
testcase_68 AC 40 ms
4,384 KB
testcase_69 AC 1 ms
4,380 KB
testcase_70 AC 48 ms
4,868 KB
testcase_71 AC 124 ms
6,596 KB
testcase_72 AC 124 ms
6,764 KB
testcase_73 AC 127 ms
6,756 KB
testcase_74 AC 125 ms
6,752 KB
testcase_75 AC 125 ms
6,720 KB
testcase_76 AC 125 ms
6,656 KB
testcase_77 AC 124 ms
6,700 KB
testcase_78 AC 1 ms
4,380 KB
testcase_79 AC 1 ms
4,380 KB
testcase_80 AC 125 ms
6,652 KB
testcase_81 AC 124 ms
6,596 KB
testcase_82 AC 125 ms
6,812 KB
testcase_83 AC 108 ms
4,624 KB
testcase_84 AC 21 ms
4,404 KB
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 AC 4 ms
4,380 KB
testcase_89 WA -
testcase_90 WA -
testcase_91 AC 8 ms
4,376 KB
testcase_92 WA -
testcase_93 AC 54 ms
6,356 KB
testcase_94 AC 33 ms
4,800 KB
testcase_95 AC 24 ms
4,592 KB
testcase_96 AC 20 ms
4,376 KB
testcase_97 AC 4 ms
4,384 KB
testcase_98 AC 66 ms
7,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<numeric>
#include<cstring>
#include<random>
#include<array>
#include<fstream>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<queue>

/*
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) std::cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", (double)v)

template<typename A, typename B>void mins(A& a, const B& b) { a = min(a, (A)b); };
template<typename A, typename B>void maxs(A& a, const B& b) { a = max(a, (A)b); };



int main() {
	ll N, X, Y; cin >> N >> X >> Y;
	vector<ll> A(N+1);
	vector<ll> P;
	A[0] = X;
	REP(i, 1, N+1) cin >> A[i];
	reverse(A.begin(), A.end());
	ll a = Y;
	ll b = ~Y;
	REP(i, 0, N) {
		if ((~A[i] & a) == 0) {
			if ((b & A[i]) == 0) {
				if(P.size() < N) P.push_back(3);
				while (P.size() != N) P.push_back(1);
				reverse(P.begin(), P.end());
				for (ll p : P) cout << p << " ";
				cout << endl;
				return 0;
			}

			b = b & A[i];
			P.push_back(1);
		}
		else if ((b & A[i]) == 0) {
			a = a & ~A[i];
			P.push_back(2);
		}
		else {
			PRI(-1);
			return 0;
		}
	}
	PRI(-1);
	return 0;
}
0