QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#625017 | #8412. Desant 3 [B] | chenxinyang2006 | 0 | 78ms | 3960kb | C++20 | 1.8kb | 2024-10-09 17:10:31 | 2024-10-09 17:10:31 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int n,m;
int a[1005],b[1005],val[45],ans[45];
void dfs(int p){
if(p == m + 1){
int s = n,t = 1;
rep(i,1,n){
if(val[i] == 1){
chkmin(s,i);
chkmax(t,i);
}
}
rep(i,1,s){
rep(j,max(t,i),n){
if(val[j] == 0) break;
ans[j - i + 1] ^= 1;
}
}
return;
}
int x = a[p],y = b[p];
if(val[x] < 0 && val[y] < 0){
val[x] = val[y] = 0;
dfs(p + 1);
val[x] = val[y] = 1;
dfs(p + 1);
val[x] = val[y] = -1;
}else{
if(!val[x]){
dfs(p + 1);
}else if(val[x] == 1){
swap(val[x],val[y]);
dfs(p + 1);
swap(val[x],val[y]);
}else if(val[y] == 1){
dfs(p + 1);
}else{
assert(!val[y]);
swap(val[x],val[y]);
dfs(p + 1);
swap(val[x],val[y]);
}
}
}
int main(){
// freopen("test.in","r",stdin);
scanf("%d%d",&n,&m);
rep(i,1,m) scanf("%d%d",&a[i],&b[i]);
rep(i,1,n) val[i] = -1;
dfs(1);
rep(i,1,n) printf("%d ",ans[i]);
printf("\n");
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3828kb
input:
7 65 3 5 2 5 1 4 1 4 5 7 3 6 5 6 1 7 3 7 3 6 6 7 3 5 5 6 2 5 5 2 7 5 7 1 1 2 4 6 3 5 1 2 1 2 5 6 1 7 3 4 2 4 3 4 2 3 3 7 3 6 2 4 3 2 5 3 7 5 2 5 4 5 5 7 4 6 1 6 3 4 5 7 1 6 5 7 4 6 3 5 1 5 2 7 4 7 1 7 1 3 1 4 5 6 1 5 4 6 1 4 4 5 1 7 1 3 4 5 2 5 4 6 2 3 2 6 1 3 4 6
output:
1 1 1 0 0 1 1
result:
wrong answer 1st lines differ - expected: '1 1 1 1 1 1 1', found: '1 1 1 0 0 1 1 '
Subtask #2:
score: 0
Wrong Answer
Test #20:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
15 129 4 7 7 8 7 15 1 4 3 12 11 13 2 14 5 8 6 7 10 13 6 11 5 12 8 14 2 4 5 11 9 15 2 7 9 10 2 14 9 13 10 12 7 15 2 11 3 7 1 12 1 15 3 11 10 14 5 15 3 9 13 11 6 5 12 5 1 11 8 11 11 13 2 10 8 14 4 10 8 11 9 14 1 15 4 8 1 3 3 14 5 8 11 13 4 9 3 11 5 13 1 2 1 11 4 11 4 11 7 10 2 9 2 8 8 14 2 5 1 7 8 13 ...
output:
1 1 1 1 1 0 1 1 0 1 1 1 1 1 0
result:
wrong answer 1st lines differ - expected: '1 1 0 0 0 0 0 0 0 1 0 1 0 0 1', found: '1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 '
Subtask #3:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 1ms
memory: 3960kb
input:
20 169 9 12 15 18 18 20 3 13 5 14 10 19 5 14 7 17 12 14 4 19 7 19 2 9 7 17 5 15 13 17 9 16 8 15 8 13 11 12 8 12 7 13 5 9 1 4 2 19 5 11 3 10 7 14 9 20 6 8 1 9 3 16 16 18 5 11 10 13 1 18 4 14 10 18 10 16 4 16 6 15 9 7 16 2 11 6 2 17 12 14 2 3 3 5 2 18 8 15 19 20 5 18 2 6 1 15 8 16 9 14 14 17 15 17 9 2...
output:
0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0
result:
wrong answer 1st lines differ - expected: '0 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1', found: '0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 '
Subtask #4:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 2ms
memory: 3956kb
input:
22 185 9 21 15 17 1 10 16 17 17 18 3 20 3 21 7 8 1 15 4 12 12 15 14 19 16 19 17 20 2 10 8 21 10 19 4 10 8 20 5 20 9 17 11 18 1 10 4 15 12 22 11 13 11 22 4 9 4 13 15 19 16 18 3 18 3 21 1 2 18 21 2 3 11 15 5 13 16 18 3 5 15 17 7 12 8 21 1 9 9 4 5 1 11 3 14 19 4 19 3 5 19 21 7 11 5 20 5 21 19 22 1 2 4 ...
output:
0 1 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 0 0 0 1
result:
wrong answer 1st lines differ - expected: '0 1 1 1 1 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 1 1', found: '0 1 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 0 0 0 1 '
Subtask #5:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 2ms
memory: 3948kb
input:
24 201 18 20 9 16 4 5 11 16 9 14 15 24 8 9 2 8 4 16 1 20 4 11 2 7 2 18 22 24 2 5 7 24 20 21 6 16 3 13 3 6 9 21 9 14 16 17 7 19 10 17 13 24 8 20 5 22 21 23 16 19 14 18 2 20 17 24 3 7 5 19 4 15 2 15 10 15 9 20 6 18 10 12 16 21 20 23 14 23 2 7 7 17 9 19 3 4 17 6 20 4 17 2 13 21 4 16 6 13 8 11 4 17 1 9 ...
output:
0 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1
result:
wrong answer 1st lines differ - expected: '0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 0 1 1', found: '0 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 '
Subtask #6:
score: 0
Wrong Answer
Test #92:
score: 0
Wrong Answer
time: 4ms
memory: 3956kb
input:
26 217 2 12 6 15 4 20 20 26 24 26 17 25 13 16 1 10 20 21 12 16 4 12 2 18 11 22 3 26 8 25 13 14 6 16 2 3 18 26 10 20 19 25 5 22 14 24 4 8 5 25 22 26 1 19 24 26 15 23 3 10 11 14 13 17 6 25 16 23 3 10 17 26 11 15 13 25 1 19 11 17 13 20 20 23 8 18 2 6 15 18 2 10 15 19 15 26 5 15 5 25 8 10 5 24 8 6 16 5 ...
output:
0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0
result:
wrong answer 1st lines differ - expected: '0 1 1 1 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 0 1 1 0 1 1', found: '0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 '
Subtask #7:
score: 0
Wrong Answer
Test #111:
score: 0
Wrong Answer
time: 9ms
memory: 3852kb
input:
29 241 6 27 21 27 2 28 8 12 17 25 19 20 6 25 14 27 8 22 2 24 3 25 8 27 13 24 15 21 7 13 8 9 6 15 12 14 2 25 20 23 1 2 16 23 10 17 9 12 9 26 19 21 12 22 12 18 9 18 7 22 8 23 4 25 8 27 10 17 9 27 15 21 19 22 7 11 4 6 14 26 16 20 2 11 4 25 15 19 16 23 23 26 4 7 6 12 18 20 11 17 1 12 1 12 11 25 3 28 20 ...
output:
1 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 0
result:
wrong answer 1st lines differ - expected: '1 1 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1', found: '1 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 0 '
Subtask #8:
score: 0
Wrong Answer
Test #130:
score: 0
Wrong Answer
time: 30ms
memory: 3956kb
input:
32 265 14 24 25 32 5 19 3 6 2 9 5 29 3 22 5 19 7 8 19 28 14 27 7 20 1 14 7 12 12 20 6 22 1 32 16 26 1 6 20 23 12 21 16 19 3 23 4 20 8 30 11 12 26 28 9 14 13 32 18 25 21 27 1 9 10 12 10 16 5 16 4 13 3 11 17 25 8 28 3 32 24 25 19 24 6 12 21 31 2 27 25 31 1 31 6 24 11 24 14 19 8 11 12 28 9 21 20 27 5 2...
output:
0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0
result:
wrong answer 1st lines differ - expected: '0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1', found: '0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0 '
Subtask #9:
score: 0
Wrong Answer
Test #149:
score: 0
Wrong Answer
time: 60ms
memory: 3912kb
input:
34 281 13 16 14 22 2 29 2 13 14 31 1 33 15 29 2 31 25 29 4 5 10 12 10 13 16 29 19 31 9 19 4 22 6 12 19 21 6 16 3 13 5 22 7 17 22 28 6 33 5 16 14 34 1 15 13 22 25 28 3 21 9 10 1 8 23 28 8 10 8 12 2 16 10 20 25 27 27 34 13 34 6 21 10 32 19 25 1 10 13 29 18 31 8 33 20 34 7 8 10 23 10 30 10 15 17 21 4 3...
output:
0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 1
result:
wrong answer 1st lines differ - expected: '0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 ...0 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1', found: '0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 ... 1 1 1 1 1 0 0 0 1 1 0 1 0 0 1 '
Subtask #10:
score: 0
Wrong Answer
Test #168:
score: 0
Wrong Answer
time: 78ms
memory: 3908kb
input:
35 289 15 29 8 17 4 15 6 17 4 35 13 33 11 17 11 19 8 33 3 34 14 22 3 7 4 8 2 11 8 30 24 33 18 23 20 25 11 18 11 12 19 29 4 25 16 32 10 33 14 16 1 12 11 13 13 30 16 29 15 32 11 18 26 27 14 30 12 21 11 13 2 34 4 21 29 35 19 35 10 27 28 35 3 16 2 23 30 34 6 14 7 16 18 30 11 23 6 33 12 15 1 22 12 34 18 ...
output:
1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0
result:
wrong answer 1st lines differ - expected: '1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 ...1 1 0 1 0 1 0 1 0 0 1 1 0 1 1 1', found: '1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 ... 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 '