Submission #36825862
Source Code Expand
#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma") #include <bits/stdc++.h> #define uint unsigned int #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pi3 pair<int, pii> #define pi4 pair<pii, pii> #define pll pair<LL, LL> #define pl3 pair<LL, pll> #define pl4 pair<pll, pll> #define pul pair<UL, UL> #define pdd pair<double, double> #define pid pair<int, double> #define ff first #define ss second #define INF (int)1e9 #define LNF (ll)1e18 #define UNF (ull)1e19 #define MOD 998'244'353 using namespace std; deque<ll> dq; int main(){ //freopen("C:/Coding/Sublime Text/output.txt", "w", stdout); //clock_t st=clock(); int n, k, c; scanf("%d %d %d", &n, &k, &c); dq.push_front(c); ll sum = 0; for(int i = 2; i <= n; i++){ sum = (sum+dq.front())%MOD; if(dq.size() >= k-1) sum = (sum+(c-2)*dq[k-2])%MOD; dq.push_front((sum+(dq.size() < k-1 ? (c-2)*dq.back() : 0))%MOD); } ll ans = 0; for(ll it : dq) ans = (ans+it)%MOD; printf("%lld", ans); //printf("%lf",((double)clock()-st)/CLOCKS_PER_SEC); return 0; }
Submission Info
Submission Time | |
---|---|
Task | G - At Most 2 Colors |
User | imtore |
Language | C++ (GCC 9.2.1) |
Score | 600 |
Code Size | 1261 Byte |
Status | AC |
Exec Time | 28 ms |
Memory | 11804 KiB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:46:16: warning: comparison of integer expressions of different signedness: ‘std::deque<long long int>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 46 | if(dq.size() >= k-1) sum = (sum+(c-2)*dq[k-2])%MOD; | ~~~~~~~~~~^~~~~~ ./Main.cpp:48:33: warning: comparison of integer expressions of different signedness: ‘std::deque<long long int>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 48 | dq.push_front((sum+(dq.size() < k-1 ? (c-2)*dq.back() : 0))%MOD); | ~~~~~~~~~~^~~~~ ./Main.cpp:39:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] 39 | int n, k, c; scanf("%d %d %d", &n, &k, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
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 |
All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt, test_71.txt, test_72.txt, test_73.txt, test_74.txt, test_75.txt, test_76.txt, test_77.txt, test_78.txt, test_79.txt, test_80.txt, test_81.txt, test_82.txt, test_83.txt, test_84.txt, test_85.txt, test_86.txt, test_87.txt, test_88.txt, test_89.txt, test_90.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 8 ms | 3692 KiB |
hand_02.txt | AC | 2 ms | 3692 KiB |
hand_03.txt | AC | 2 ms | 3640 KiB |
hand_04.txt | AC | 2 ms | 3744 KiB |
hand_05.txt | AC | 2 ms | 3564 KiB |
hand_06.txt | AC | 2 ms | 3712 KiB |
hand_07.txt | AC | 2 ms | 3564 KiB |
hand_08.txt | AC | 2 ms | 3564 KiB |
hand_09.txt | AC | 22 ms | 11640 KiB |
hand_10.txt | AC | 27 ms | 11680 KiB |
hand_11.txt | AC | 25 ms | 11620 KiB |
sample_01.txt | AC | 2 ms | 3560 KiB |
sample_02.txt | AC | 2 ms | 3564 KiB |
sample_03.txt | AC | 2 ms | 3756 KiB |
test_01.txt | AC | 2 ms | 3640 KiB |
test_02.txt | AC | 3 ms | 3640 KiB |
test_03.txt | AC | 2 ms | 3632 KiB |
test_04.txt | AC | 2 ms | 3744 KiB |
test_05.txt | AC | 2 ms | 3640 KiB |
test_06.txt | AC | 2 ms | 3580 KiB |
test_07.txt | AC | 2 ms | 3688 KiB |
test_08.txt | AC | 2 ms | 3640 KiB |
test_09.txt | AC | 2 ms | 3580 KiB |
test_10.txt | AC | 2 ms | 3692 KiB |
test_11.txt | AC | 2 ms | 3636 KiB |
test_12.txt | AC | 2 ms | 3744 KiB |
test_13.txt | AC | 2 ms | 3636 KiB |
test_14.txt | AC | 3 ms | 3636 KiB |
test_15.txt | AC | 2 ms | 3740 KiB |
test_16.txt | AC | 4 ms | 3700 KiB |
test_17.txt | AC | 2 ms | 3696 KiB |
test_18.txt | AC | 2 ms | 3740 KiB |
test_19.txt | AC | 2 ms | 3696 KiB |
test_20.txt | AC | 2 ms | 3688 KiB |
test_21.txt | AC | 2 ms | 3692 KiB |
test_22.txt | AC | 2 ms | 3592 KiB |
test_23.txt | AC | 2 ms | 3592 KiB |
test_24.txt | AC | 2 ms | 3576 KiB |
test_25.txt | AC | 3 ms | 3712 KiB |
test_26.txt | AC | 2 ms | 3700 KiB |
test_27.txt | AC | 2 ms | 3564 KiB |
test_28.txt | AC | 2 ms | 3636 KiB |
test_29.txt | AC | 2 ms | 3564 KiB |
test_30.txt | AC | 2 ms | 3692 KiB |
test_31.txt | AC | 21 ms | 11220 KiB |
test_32.txt | AC | 17 ms | 8708 KiB |
test_33.txt | AC | 2 ms | 3784 KiB |
test_34.txt | AC | 12 ms | 7264 KiB |
test_35.txt | AC | 16 ms | 9132 KiB |
test_36.txt | AC | 5 ms | 4684 KiB |
test_37.txt | AC | 25 ms | 11660 KiB |
test_38.txt | AC | 4 ms | 4028 KiB |
test_39.txt | AC | 12 ms | 7056 KiB |
test_40.txt | AC | 15 ms | 6276 KiB |
test_41.txt | AC | 13 ms | 6864 KiB |
test_42.txt | AC | 12 ms | 6824 KiB |
test_43.txt | AC | 20 ms | 10344 KiB |
test_44.txt | AC | 17 ms | 9680 KiB |
test_45.txt | AC | 11 ms | 5632 KiB |
test_46.txt | AC | 18 ms | 8160 KiB |
test_47.txt | AC | 7 ms | 5556 KiB |
test_48.txt | AC | 20 ms | 11304 KiB |
test_49.txt | AC | 16 ms | 8384 KiB |
test_50.txt | AC | 14 ms | 8156 KiB |
test_51.txt | AC | 6 ms | 4708 KiB |
test_52.txt | AC | 5 ms | 4632 KiB |
test_53.txt | AC | 10 ms | 5704 KiB |
test_54.txt | AC | 13 ms | 7180 KiB |
test_55.txt | AC | 3 ms | 3936 KiB |
test_56.txt | AC | 12 ms | 5896 KiB |
test_57.txt | AC | 19 ms | 8248 KiB |
test_58.txt | AC | 24 ms | 10712 KiB |
test_59.txt | AC | 13 ms | 7336 KiB |
test_60.txt | AC | 11 ms | 5960 KiB |
test_61.txt | AC | 22 ms | 11752 KiB |
test_62.txt | AC | 25 ms | 11616 KiB |
test_63.txt | AC | 27 ms | 11748 KiB |
test_64.txt | AC | 22 ms | 11636 KiB |
test_65.txt | AC | 26 ms | 11804 KiB |
test_66.txt | AC | 23 ms | 11620 KiB |
test_67.txt | AC | 24 ms | 11636 KiB |
test_68.txt | AC | 26 ms | 11652 KiB |
test_69.txt | AC | 26 ms | 11796 KiB |
test_70.txt | AC | 22 ms | 11652 KiB |
test_71.txt | AC | 24 ms | 11640 KiB |
test_72.txt | AC | 20 ms | 11748 KiB |
test_73.txt | AC | 23 ms | 11700 KiB |
test_74.txt | AC | 26 ms | 11640 KiB |
test_75.txt | AC | 27 ms | 11768 KiB |
test_76.txt | AC | 22 ms | 11748 KiB |
test_77.txt | AC | 22 ms | 11796 KiB |
test_78.txt | AC | 28 ms | 11748 KiB |
test_79.txt | AC | 28 ms | 11620 KiB |
test_80.txt | AC | 20 ms | 11748 KiB |
test_81.txt | AC | 26 ms | 11632 KiB |
test_82.txt | AC | 24 ms | 11720 KiB |
test_83.txt | AC | 21 ms | 11800 KiB |
test_84.txt | AC | 21 ms | 11732 KiB |
test_85.txt | AC | 24 ms | 11692 KiB |
test_86.txt | AC | 23 ms | 11692 KiB |
test_87.txt | AC | 25 ms | 11800 KiB |
test_88.txt | AC | 22 ms | 11692 KiB |
test_89.txt | AC | 21 ms | 11640 KiB |
test_90.txt | AC | 25 ms | 11620 KiB |