Submission #70656561
Source Code Expand
#include<bits/stdc++.h>
#include<atcoder/convolution>
using namespace std;
using namespace atcoder;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll d,n;
cin >> d >> n;
vector<ll> poly={0,1,0,1,1,0,1};
vector<ll> dp={1};
for(ll lv=0;lv<20;lv++){
if(d&(1ll<<lv)){
dp=convolution(dp,poly);
while(dp.size()>n+1){dp.pop_back();}
}
poly=convolution(poly,poly);
while(poly.size()>n+1){poly.pop_back();}
}
cout << dp[n] << "\n";
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Snack |
| User | physics0523 |
| Language | C++ 20 (gcc 12.2) |
| Score | 2 |
| Code Size | 546 Byte |
| Status | AC |
| Exec Time | 598 ms |
| Memory | 75784 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:18:22: warning: comparison of integer expressions of different signedness: ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} and ‘ll’ {aka ‘long long int’} [-Wsign-compare]
18 | while(dp.size()>n+1){dp.pop_back();}
| ~~~~~~~~~^~~~
Main.cpp:21:24: warning: comparison of integer expressions of different signedness: ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} and ‘ll’ {aka ‘long long int’} [-Wsign-compare]
21 | while(poly.size()>n+1){poly.pop_back();}
| ~~~~~~~~~~~^~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 2 / 2 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 02_corner_00.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3464 KiB |
| 00_sample_01.txt | AC | 598 ms | 75784 KiB |
| 01_random_00.txt | AC | 332 ms | 40500 KiB |
| 01_random_01.txt | AC | 531 ms | 73060 KiB |
| 01_random_02.txt | AC | 586 ms | 63956 KiB |
| 02_corner_00.txt | AC | 123 ms | 13092 KiB |