# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
102528 |
2019-03-25T17:27:17 Z |
Nnandi |
Mobitel (COCI19_mobitel) |
C++14 |
|
1474 ms |
5760 KB |
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
const int maxrs = 305;
const int maxme = 1005;
const ll mod = 1000000007LL;
ll dpkis[maxrs][maxme];
ll dpkisuj[maxrs][maxme];
ll dpnagy[maxrs][maxme];
ll dpnagyuj[maxrs][maxme];
ll tab[maxrs][maxrs];
int r, s;
ll n, m;
int main()
{
cin>>r>>s>>n;
m = (ll)sqrt(n);
for(int i=0;i<r;i++) {
for(int j=0;j<s;j++) {
cin>>tab[i][j];
}
}
for(int i=0;i<r;i++) {
for(int j=0;j<s;j++) {
for(int c=1;c<=m;c++) {
int req = (int)max((ll)1,(c + tab[i][j] - 1) / tab[i][j]);
dpkisuj[j][c] = 0LL;
if(i==0 && j==0 && c<=tab[i][j]) dpkisuj[j][c] = 1LL;
dpkisuj[j][c] += (i > 0 ? dpkis[j][req] : 0LL);
dpkisuj[j][c] += (j > 0 ? dpkisuj[j-1][req] : 0LL);
dpkisuj[j][c] %= mod;
}
for(int c=1;c<=m;c++) {
if(c * tab[i][j] > m) {
int prereq = (n+c-1) / c;
int req = (prereq + tab[i][j] - 1) / tab[i][j];
dpnagyuj[j][c] = 0LL;
if(i == 0 && j == 0 && n <= c) dpnagyuj[j][c] = 1LL;
dpnagyuj[j][c] += (i > 0 ? dpkis[j][req] : 0LL);
dpnagyuj[j][c] += (j > 0 ? dpkisuj[j-1][req] : 0LL);
dpnagyuj[j][c] %= mod;
}
else {
int req = c * tab[i][j];
dpnagyuj[j][c] = 0LL;
if(i == 0 && j == 0 && n <= c) dpnagyuj[j][c] = 1LL;
dpnagyuj[j][c] += (i > 0 ? dpnagy[j][req] : 0LL);
dpnagyuj[j][c] += (j > 0 ? dpnagyuj[j-1][req] : 0LL);
dpnagyuj[j][c] %= mod;
}
}
}
swap(dpkis,dpkisuj);
swap(dpnagy,dpnagyuj);
}
cout<<dpnagy[s-1][1]<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
291 ms |
5624 KB |
Output isn't correct |
2 |
Correct |
210 ms |
5760 KB |
Output is correct |
3 |
Correct |
195 ms |
5444 KB |
Output is correct |
4 |
Correct |
193 ms |
5248 KB |
Output is correct |
5 |
Correct |
205 ms |
5248 KB |
Output is correct |
6 |
Incorrect |
186 ms |
5248 KB |
Output isn't correct |
7 |
Correct |
109 ms |
5220 KB |
Output is correct |
8 |
Correct |
827 ms |
5516 KB |
Output is correct |
9 |
Correct |
1241 ms |
5632 KB |
Output is correct |
10 |
Correct |
1474 ms |
5752 KB |
Output is correct |