Submission #56607525
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD=998244353;
const ll INF=0x3f3f3f3f3f3f3f3f;
inline ll read()
{
ll res=0, f=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9') res=res*10+c-'0', c=getchar();
return res*f;
}
inline ll qpow(ll x,ll y)
{
ll res=1;
while(y)
{
if(y&1) res=(res*x)%MOD;
y>>=1;
x=(x*x)%MOD;
}
return res;
}
void solve()
{
ll n=read(), K=read();
if(K==1)
{
while(n--) printf("1 ");
puts("");
return ;
}
if(n>=(1ll<<(K-1)))
{
for(ll i=(1ll<<(K-1));i<(1ll<<K);i++) printf("%lld ",i);
n-=(1ll<<(K-1));
while(n--) printf("1 ");
puts("");
return ;
}
vector<ll> ve, w;
ll inc=(1ll<<(K-2));
w.push_back((1ll<<(K-1)));
int now=0;
while(n--)
{
if(now==w.size())
{
for(int i=0;i<w.size();i++) ve.push_back(w[i]);
w.clear();
for(int i=0;i<ve.size();i++) w.push_back(ve[i]+inc);
inc/=2;
now=0;
printf("%lld ",w[0]);
}
else printf("%lld ",w[now]);
now++;
}
puts("");
return ;
}
int main()
{
ll T=read();
while(T--) solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - |{floor(A_i/2^k)}| |
| User | GS256 |
| Language | C++ 20 (gcc 12.2) |
| Score | 500 |
| Code Size | 1326 Byte |
| Status | AC |
| Exec Time | 19 ms |
| Memory | 4624 KiB |
Compile Error
Main.cpp: In function ‘void solve()’:
Main.cpp:67:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
67 | if(now==w.size())
| ~~~^~~~~~~~~~
Main.cpp:69:38: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
69 | for(int i=0;i<w.size();i++) ve.push_back(w[i]);
| ~^~~~~~~~~
Main.cpp:71:38: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
71 | for(int i=0;i<ve.size();i++) w.push_back(ve[i]+inc);
| ~^~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt |
| All | 00-sample-001.txt, 01-handmade-001.txt, 01-handmade-002.txt, 01-handmade-003.txt, 01-handmade-004.txt, 01-handmade-005.txt, 01-handmade-006.txt, 01-handmade-007.txt, 01-handmade-008.txt, 01-handmade-009.txt, 02-small-001.txt, 02-small-002.txt, 02-small-003.txt, 02-small-004.txt, 02-small-005.txt, 02-small-006.txt, 02-small-007.txt, 02-small-008.txt, 02-small-009.txt, 02-small-010.txt, 02-small-011.txt, 02-small-012.txt, 03-random-001.txt, 03-random-002.txt, 03-random-003.txt, 03-random-004.txt, 03-random-005.txt, 03-random-006.txt, 03-random-007.txt, 03-random-008.txt, 03-random-009.txt, 03-random-010.txt, 04-large-001.txt, 04-large-002.txt, 04-large-003.txt, 04-large-004.txt, 04-large-005.txt, 04-large-006.txt, 04-large-007.txt, 04-large-008.txt, 04-large-009.txt, 04-large-010.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 1 ms | 3748 KiB |
| 01-handmade-001.txt | AC | 12 ms | 4408 KiB |
| 01-handmade-002.txt | AC | 12 ms | 4140 KiB |
| 01-handmade-003.txt | AC | 7 ms | 3556 KiB |
| 01-handmade-004.txt | AC | 10 ms | 4104 KiB |
| 01-handmade-005.txt | AC | 8 ms | 3988 KiB |
| 01-handmade-006.txt | AC | 9 ms | 4088 KiB |
| 01-handmade-007.txt | AC | 7 ms | 3704 KiB |
| 01-handmade-008.txt | AC | 10 ms | 4484 KiB |
| 01-handmade-009.txt | AC | 11 ms | 4284 KiB |
| 02-small-001.txt | AC | 16 ms | 3624 KiB |
| 02-small-002.txt | AC | 19 ms | 3616 KiB |
| 02-small-003.txt | AC | 12 ms | 3748 KiB |
| 02-small-004.txt | AC | 12 ms | 3768 KiB |
| 02-small-005.txt | AC | 11 ms | 3760 KiB |
| 02-small-006.txt | AC | 12 ms | 3760 KiB |
| 02-small-007.txt | AC | 12 ms | 3764 KiB |
| 02-small-008.txt | AC | 11 ms | 3828 KiB |
| 02-small-009.txt | AC | 11 ms | 3628 KiB |
| 02-small-010.txt | AC | 12 ms | 3764 KiB |
| 02-small-011.txt | AC | 12 ms | 3692 KiB |
| 02-small-012.txt | AC | 12 ms | 3768 KiB |
| 03-random-001.txt | AC | 10 ms | 4344 KiB |
| 03-random-002.txt | AC | 10 ms | 3748 KiB |
| 03-random-003.txt | AC | 13 ms | 4424 KiB |
| 03-random-004.txt | AC | 8 ms | 3896 KiB |
| 03-random-005.txt | AC | 9 ms | 4120 KiB |
| 03-random-006.txt | AC | 8 ms | 4208 KiB |
| 03-random-007.txt | AC | 11 ms | 4244 KiB |
| 03-random-008.txt | AC | 11 ms | 4220 KiB |
| 03-random-009.txt | AC | 6 ms | 3872 KiB |
| 03-random-010.txt | AC | 8 ms | 3956 KiB |
| 04-large-001.txt | AC | 7 ms | 3748 KiB |
| 04-large-002.txt | AC | 11 ms | 4360 KiB |
| 04-large-003.txt | AC | 7 ms | 3748 KiB |
| 04-large-004.txt | AC | 11 ms | 4136 KiB |
| 04-large-005.txt | AC | 12 ms | 4200 KiB |
| 04-large-006.txt | AC | 11 ms | 4248 KiB |
| 04-large-007.txt | AC | 14 ms | 4624 KiB |
| 04-large-008.txt | AC | 12 ms | 4132 KiB |
| 04-large-009.txt | AC | 12 ms | 4376 KiB |
| 04-large-010.txt | AC | 11 ms | 4436 KiB |