Task: | Zbrka |
Sender: | untokarila |
Submission time: | 2019-07-26 15:31:11 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
#7 | ACCEPTED | 0.06 s | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> #define P 1000000007 #define ll long long using namespace std; ll d[2][1010101], z = 1, s = 0; int main(){ int n, c; cin >> n >> c; d[1][1] = 1; for(int i=1; i<=n; i++){ z += i-1; int h = (z+1)/2; for(int j=1; j<=h; j++){ d[s][j] = d[s][j-1]+d[s^1][j]; if(j>i) d[s][j] -= d[s^1][j-i]; if(d[s][j]<0) d[s][j]+=P; d[s][j]%=P; } if(z&1){ for(int j=1; j<h; j++){ d[s][j+h] = d[s][h-j]; } } else { for(int j=1; j<h+1; j++){ d[s][j+h] = d[s][h-j+1]; } } s^=1; } cout << d[s^1][c+1]; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Verdict: ACCEPTED
input |
---|
9 36 |
correct output |
---|
1 |
user output |
---|
1 |
Test 3
Verdict: ACCEPTED
input |
---|
9 37 |
correct output |
---|
0 |
user output |
---|
0 |
Test 4
Verdict: ACCEPTED
input |
---|
20 191 |
correct output |
---|
0 |
user output |
---|
0 |
Test 5
Verdict: ACCEPTED
input |
---|
51 93 |
correct output |
---|
652564375 |
user output |
---|
652564375 |
Test 6
Verdict: ACCEPTED
input |
---|
150 15 |
correct output |
---|
906085333 |
user output |
---|
906085333 |
Test 7
Verdict: ACCEPTED
input |
---|
432 10000 |
correct output |
---|
532401236 |
user output |
---|
532401236 |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
987 4 |
correct output |
---|
621481900 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
999 931 |
correct output |
---|
502211067 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
999 5000 |
correct output |
---|
722028249 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
999 8234 |
correct output |
---|
263421764 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 10000 |
correct output |
---|
463544056 |
user output |
---|
(empty) |