QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#258563 | #1261. Inv | chenxinyang2006 | AC ✓ | 223ms | 11616kb | C++14 | 1.1kb | 2023-11-19 20:11:20 | 2023-11-19 20:11:20 |
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,k;
bitset <125005> dp[505];
int main(){
scanf("%d%d",&n,&k);
dp[0].set(0);
rep(i,1,n){
dp[i] = dp[i - 1];
rep(j,1,i - 1) dp[i] ^= dp[i - 2] << (2 * (i - j) - 1);
}
printf("%d\n",dp[n].test(k));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3908kb
input:
4 1
output:
1
result:
ok answer is '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4044kb
input:
10 21
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 218ms
memory: 11420kb
input:
500 124331
output:
0
result:
ok answer is '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 4204kb
input:
20 122
output:
1
result:
ok answer is '1'
Test #5:
score: 0
Accepted
time: 10ms
memory: 6564kb
input:
100 999
output:
0
result:
ok answer is '0'
Test #6:
score: 0
Accepted
time: 218ms
memory: 11572kb
input:
500 100001
output:
1
result:
ok answer is '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
5 0
output:
1
result:
ok answer is '1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
5 1
output:
0
result:
ok answer is '0'
Test #9:
score: 0
Accepted
time: 0ms
memory: 4056kb
input:
5 2
output:
1
result:
ok answer is '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
5 3
output:
1
result:
ok answer is '1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
5 4
output:
0
result:
ok answer is '0'
Test #12:
score: 0
Accepted
time: 0ms
memory: 4056kb
input:
5 5
output:
0
result:
ok answer is '0'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
5 6
output:
0
result:
ok answer is '0'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4056kb
input:
5 7
output:
1
result:
ok answer is '1'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
5 8
output:
1
result:
ok answer is '1'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
5 9
output:
0
result:
ok answer is '0'
Test #17:
score: 0
Accepted
time: 0ms
memory: 4060kb
input:
5 10
output:
1
result:
ok answer is '1'
Test #18:
score: 0
Accepted
time: 219ms
memory: 11464kb
input:
500 73732
output:
1
result:
ok answer is '1'
Test #19:
score: 0
Accepted
time: 210ms
memory: 11452kb
input:
499 21121
output:
1
result:
ok answer is '1'
Test #20:
score: 0
Accepted
time: 219ms
memory: 11500kb
input:
499 100000
output:
0
result:
ok answer is '0'
Test #21:
score: 0
Accepted
time: 218ms
memory: 11408kb
input:
499 62262
output:
1
result:
ok answer is '1'
Test #22:
score: 0
Accepted
time: 219ms
memory: 11556kb
input:
499 23432
output:
1
result:
ok answer is '1'
Test #23:
score: 0
Accepted
time: 219ms
memory: 11544kb
input:
500 12321
output:
0
result:
ok answer is '0'
Test #24:
score: 0
Accepted
time: 218ms
memory: 11532kb
input:
500 60000
output:
1
result:
ok answer is '1'
Test #25:
score: 0
Accepted
time: 223ms
memory: 11504kb
input:
498 7498
output:
1
result:
ok answer is '1'
Test #26:
score: 0
Accepted
time: 214ms
memory: 11444kb
input:
498 76111
output:
1
result:
ok answer is '1'
Test #27:
score: 0
Accepted
time: 150ms
memory: 11016kb
input:
414 41414
output:
1
result:
ok answer is '1'
Test #28:
score: 0
Accepted
time: 156ms
memory: 10424kb
input:
422 42224
output:
1
result:
ok answer is '1'
Test #29:
score: 0
Accepted
time: 98ms
memory: 10168kb
input:
333 33333
output:
1
result:
ok answer is '1'
Test #30:
score: 0
Accepted
time: 214ms
memory: 11544kb
input:
500 51515
output:
1
result:
ok answer is '1'
Test #31:
score: 0
Accepted
time: 136ms
memory: 10652kb
input:
393 21222
output:
1
result:
ok answer is '1'
Test #32:
score: 0
Accepted
time: 219ms
memory: 11616kb
input:
500 124750
output:
1
result:
ok answer is '1'
Test #33:
score: 0
Accepted
time: 215ms
memory: 11420kb
input:
500 124749
output:
1
result:
ok answer is '1'
Test #34:
score: 0
Accepted
time: 215ms
memory: 11616kb
input:
500 0
output:
1
result:
ok answer is '1'
Test #35:
score: 0
Accepted
time: 215ms
memory: 11480kb
input:
500 1
output:
1
result:
ok answer is '1'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
1 0
output:
1
result:
ok answer is '1'