QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629843 | #9428. Be Positive | qwqpmp# | WA | 0ms | 3652kb | C++14 | 1.2kb | 2024-10-11 15:10:08 | 2024-10-11 15:10:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i = a; i < n; i++)
#define per(i,a,n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define endl '\n'
#define SZ(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }
const ll mod = 1000000007;
// head
int n;
void solve() {
cin >> n;
ll pre = 0;
vi rs;
rep(i,0,n) pre ^= i, rs.pb(i);
if (!pre) {
cout << "impossible" << endl;
return;
}
while (1) {
random_shuffle(all(rs));
// for (auto x : rs) cerr << x << " ";
// cerr << "\n";
ll rpre = 0, ok = 0;
rep(i,0,n) {
rpre ^= rs[i];
ok |= (rpre == 0);
if (ok) break;
}
if (!ok) {
for (auto x : rs) cout << x << " ";
cout << endl;
break;
}
}
}
int tc;
signed main() {
ios::sync_with_stdio(0);
// freopen("qwq.in","r",stdin);
// freopen("qwq.out","w",stdout);
cin >> tc;
while (tc --) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
input:
4 1 2 3 4
output:
impossible 1 0 2 0 1 impossible
result:
wrong answer Jury has better answer (test case 3)