Submission #27857443
Source Code Expand
Copy
#include <iostream>#include <string>#include <vector>using u32 = unsigned int;using u64 = unsigned long long int;int main(){u64 n, x;std::cin >> n >> x;std::vector<u64> a(n);for(u32 i = 0; i < n; i++) std::cin >> a[i];for(u32 i = 0; i < n-1; i++) a[i] = a[i+1] / a[i];u64 P1 = 0;u64 P0 = 1;u32 l = 0;while(l < n-1){
#include <iostream> #include <string> #include <vector> using u32 = unsigned int; using u64 = unsigned long long int; int main(){ u64 n, x; std::cin >> n >> x; std::vector<u64> a(n); for(u32 i = 0; i < n; i++) std::cin >> a[i]; for(u32 i = 0; i < n-1; i++) a[i] = a[i+1] / a[i]; u64 P1 = 0; u64 P0 = 1; u32 l = 0; while(l < n-1){ u64 k = x % a[l]; u64 PP0 = (k!=a[l]-1)*P1 + P0; P1 = P1 + (k>0)*P0; P0 = PP0; x /= a[l++]; } std::cout << (P0 + P1) << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Valid payments |
User | ryuhei |
Language | C++ (GCC 9.2.1) |
Score | 600 |
Code Size | 559 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 3620 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | answer_big_00.txt, border_00.txt, border_01.txt, border_02.txt, border_03.txt, border_04.txt, border_05.txt, border_06.txt, border_07.txt, border_08.txt, border_09.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, longest_00.txt, longest_01.txt, longest_02.txt, longest_03.txt, longest_04.txt, overflow_killer_00.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
answer_big_00.txt | AC | 7 ms | 3444 KB |
border_00.txt | AC | 3 ms | 3556 KB |
border_01.txt | AC | 2 ms | 3592 KB |
border_02.txt | AC | 3 ms | 3448 KB |
border_03.txt | AC | 2 ms | 3596 KB |
border_04.txt | AC | 2 ms | 3384 KB |
border_05.txt | AC | 5 ms | 3512 KB |
border_06.txt | AC | 2 ms | 3600 KB |
border_07.txt | AC | 2 ms | 3612 KB |
border_08.txt | AC | 2 ms | 3608 KB |
border_09.txt | AC | 2 ms | 3392 KB |
handmade_00.txt | AC | 2 ms | 3568 KB |
handmade_01.txt | AC | 2 ms | 3508 KB |
handmade_02.txt | AC | 2 ms | 3444 KB |
handmade_03.txt | AC | 3 ms | 3420 KB |
longest_00.txt | AC | 2 ms | 3420 KB |
longest_01.txt | AC | 2 ms | 3620 KB |
longest_02.txt | AC | 2 ms | 3392 KB |
longest_03.txt | AC | 2 ms | 3600 KB |
longest_04.txt | AC | 2 ms | 3552 KB |
overflow_killer_00.txt | AC | 2 ms | 3600 KB |
random_00.txt | AC | 1 ms | 3388 KB |
random_01.txt | AC | 2 ms | 3608 KB |
random_02.txt | AC | 2 ms | 3384 KB |
random_03.txt | AC | 2 ms | 3612 KB |
random_04.txt | AC | 2 ms | 3512 KB |
random_05.txt | AC | 2 ms | 3604 KB |
random_06.txt | AC | 2 ms | 3388 KB |
random_07.txt | AC | 4 ms | 3600 KB |
random_08.txt | AC | 2 ms | 3596 KB |
random_09.txt | AC | 2 ms | 3592 KB |
sample_01.txt | AC | 2 ms | 3604 KB |
sample_02.txt | AC | 2 ms | 3452 KB |
sample_03.txt | AC | 3 ms | 3512 KB |
sample_04.txt | AC | 2 ms | 3592 KB |