QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#627041 | #9428. Be Positive | E7k# | WA | 0ms | 3552kb | C++20 | 1.2kb | 2024-10-10 14:33:28 | 2024-10-10 14:33:28 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define gcd __gcd
using namespace std;
typedef pair<int,int> pii;
const int INF = 9e18;
const int inf = 2e9;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
int qmi(int a,int k)
{
int res = 1;
while(k)
{
if(k & 1) res = res * a % mod;
k >>= 1;
a = a * a % mod;
}
return res;
}
int inv(int x)
{
return qmi(x,mod-2);
}
int MOD(int x)
{
return (x % mod + mod) % mod;
}
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t --)
{
int n ;
cin >> n;
set<int> se;
int now = 0,mi = 0;
vector<int> vis(n + 1);
for(int i = 1;i <= n;i ++)
{
if((now ^ mi) == 0)
{
now ^= (mi + 1),vis[mi + 1] = 1;
cout << (mi + 1) << " ";
}
else
{
now ^= mi;
cout << mi << ' ';
mi ++;
while(vis[mi]) mi ++;
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
4 1 2 3 4
output:
1 1 0 1 0 2 1 0 2 4
result:
wrong answer not permutation (test case 1)