QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#851758 | #9575. $P \oplus Q = R$ | BUET_ALUCHASHI# | WA | 1ms | 3748kb | C++20 | 4.2kb | 2025-01-10 23:32:50 | 2025-01-10 23:32:50 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// to erase in multiset-> less_equal<T> and
// s.erase(s.find_by_order(s.order_of_key(x)))
// lower_bound(x)=>(cannot use the stl lower_bound function)
// ll idx = s.order_of_key(x)
// if(idx == s.size()) -> no lower_bound
// else lb = *s.find_by_order(idx) // as 0-indexing
// idx-1 will give highest value which is strictly less than x
// for upper_bound->do the same with (x+1)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef tuple<ll, ll, ll> t64;
typedef vector<t64> vt64;
typedef vector<vt64> vvt64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef vector<vector<p32> > vvp32;
typedef vector<bool> vb;
ll mod = 1e9+7, MOD = 998244353;
double eps = 1e-12;
#define FOR(s, e, i) for(ll i = s; i <= e; i++)
#define ROF(s ,e, i) for(ll i = s; i >= e; i--)
#define F0R(i, e) for(ll i = 0; i < (e); i++)
#define trav(e, a) for(auto &e : a)
#define coutAll(A) for(auto asdafas : A) cout << asdafas << " "; cout << "\n";
#define foutAll(A) for(auto asdafas : A) fout << asdafas << " "; cout << "\n";
#define cinAll(A) for(auto &asdafas : A) cin >> asdafas;
#define finAll(A) for(auto &asdafas : A) fin >> asdafas;
#define minpq priority_queue<ll, v64, greater<ll>>
#define maxpq priority_queue<ll>
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
ll inf = LLONG_MAX;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define yes cout<<"yes\n"
#define no cout<<"no\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pii;
#define MAXN 100000000
void solve(int it)
{
// int n = it;
// // cin >> n;
// cout << it << "\n";
// v64 A(n);
// iota(all(A), 0);
// v64 B = A;
// do{
// set<ll>s;
// FOR(0, n - 1, i){
// s.insert(A[i]^B[i]);
// }
// if(sz(s)==n && *s.begin()==0 && *s.rbegin()==n-1){
// // coutAll(A);
// coutAll(B);
// // FOR(0, n - 1, i) cout << (A[i]^B[i]) << " ";
// // cout << '\n';
// cout << '\n';
// }
// }while(next_permutation(all(B)));
int n;
cin >> n;
if(n<=2){
Yes;
F0R(j, 2){
FOR(0, n-1, i) cout << i << " ";
cout << '\n';
}
return;
}
int bit = log2(n);
if((1<<bit) != n){
cout << "No\n";
return;
}
v32 A(n);
iota(all(A), 0);
v64 B;
FOR(0, n-1, i){
B.pb(i);
++i;
}
FOR(1, n-3, i){
B.pb(i+2);
B.pb(i);
i+=3;
}
Yes;
coutAll(A);
coutAll(B);
// set<ll>s;
// FOR(0, n - 1, i) {
// cout << (A[i]^B[i]) << " ";
// s.insert(A[i]^B[i]);
// }
// cout << "\n";
// if(sz(s) == n && *s.rbegin() == n-1){
// Yes;
// }
// else{
// No;
// }
}
int main()
{
// freopen("text.txt", "w", stdout);
fast_cin();
ll t = 1;
cin >> t;
for(int it=1; it<=t; it++)
{
//cout << "Case " << it << ": ";
solve(it);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3708kb
input:
2 3 4
output:
No Yes 0 1 2 3 0 2 3 1
result:
ok Correct. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3748kb
input:
1999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
Yes 0 0 Yes 0 1 0 1 No Yes 0 1 2 3 0 2 3 1 No No No Yes 0 1 2 3 4 5 6 7 0 2 4 6 3 1 7 5 No No No No No No No Yes 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 2 4 6 8 10 12 14 3 1 7 5 11 9 15 13 No No No No No No No No No No No No No No No Yes 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20...
result:
wrong answer Testcase 2, n = 2, Participant's solution is incorrect. cntr[ 0] = 2 (test case 2)