QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#369720 | #8174. Set Construction | edisnimorF | WA | 1ms | 3944kb | C++14 | 1.5kb | 2024-03-28 16:59:42 | 2024-03-28 16:59:42 |
Judging History
answer
#include<bits/stdc++.h>
#define il inline
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define pii pair<int, int>
#define fr first
#define sc second
#define ll long long
#define eb emplace_back
#define mset(f, z) memset(f, z, sizeof(f))
#define mcpy(f, g) memcpy(f, g, sizeof(g))
using namespace std;
template<typename T=ll>
il T rd(){
T s=0; bool f=1; char c=getchar();
while(!isdigit(c)) f^=(c=='-'), c=getchar();
while(isdigit(c)) s=s*10+c-'0', c=getchar();
return f? s:-s;
}
template<typename T> il void ckmx(T &x, T y){if(x<y) x=y;}
template<typename T> il void ckmn(T &x, T y){if(y<x) x=y;}
char _begin;
int n, m, p;
ll real(int l, int r){ll re=0; for(int i=l; i<=r; i++) re|=1ll<<i; return re;}
ll holl(int l, int r){ll re=0; for(int i=l; i<=r; i++) re|=(i!=p)*1ll<<i; return re;}
void solve(){
n=rd(), m=rd();
if(m==2) return printf("%lld %lld\n", 0ll, (1ll<<n)-1), void();
vector<ll> ans;
//
#define insert(l, r) \
{ \
ans.eb(real(l, r)); \
ans.eb(holl(l, r)); \
m-=2; \
if(m<2) goto finish; \
}
//
p=n/2;
insert(p, p);
ans.eb(real(0, n-1)), m--;
if(m)
for(int i=1; p-i>=0 && p+i<n; i++){
if(p-i>0 || p+i!=n-1) insert(p-i, p+i);
for(int j=0; j<i; j++){
insert(p-i, p+j);
insert(p-j, p+i);
}
}
finish:;
if(m) ans.eb(holl(0, n-1));
for(ll i:ans) printf("%lld ", i);
puts("");
}
char _end;
signed main(){
debug("%lfMB\n", (&_end-&_begin)/1024./1024.);
int T=rd();
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3944kb
input:
3 3 5 4 8 60 2
output:
2 0 7 3 1 4 0 15 14 10 6 2 11 0 1152921504606846975
result:
ok AC
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3828kb
input:
30 6 2 6 3 6 4 6 5 6 6 6 7 6 8 6 9 6 10 6 11 6 12 6 13 6 14 6 15 6 16 6 17 6 18 6 19 6 20 6 21 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 10 7 11
output:
0 63 8 0 55 8 0 63 28 20 55 8 0 63 28 20 8 0 63 28 20 55 8 0 63 28 20 12 4 8 0 63 28 20 12 4 55 8 0 63 28 20 12 4 24 16 8 0 63 28 20 12 4 24 16 55 8 0 63 28 20 12 4 24 16 62 54 8 0 63 28 20 12 4 24 16 62 54 55 8 0 63 28 20 12 4 24 16 62 54 14 6 8 0 63 28 20 12 4 24 16 62 54 14 6 55 8 0 6...
result:
wrong answer 63 is not in A