# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200098 | Saboon | Mobitel (COCI19_mobitel) | C++14 | 4324 ms | 11872 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
int t[300 + 10];
int nex[300 + 10][3000 + 200], dp[300 + 10][3000 + 200], pos[1000000 + 10];
int main(){
ios_base::sync_with_stdio(false);
int n, m, k;
cin >> n >> m >> k;
k --;
vector<int> a;
for (int i = 1; i <= k + 1; i++)
a.push_back(k / i);
sort(a.begin(), a.end());
a.resize(unique(a.begin(), a.end()) - a.begin());
for (int i = 0; i < a.size(); i++)
pos[a[i]] = i;
int c = a.size();
dp[0][c - 1] = 1;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++)
cin >> t[j];
for (int j = 0; j < m; j++)
for (int x = 0; x < c; x++)
nex[j][pos[a[x] / t[j]]] = (nex[j][pos[a[x] / t[j]]] + dp[j][x]) % mod;
for (int j = 1; j < m; j++)
for (int x = 0; x < c; x++)
nex[j][pos[a[x] / t[j]]] = (nex[j][pos[a[x] / t[j]]] + nex[j - 1][x]) % mod;
for (int j = 0; j < m; j++)
for (int x = 0; x < c; x++)
dp[j][x] = nex[j][x], nex[j][x] = 0;
}
cout << dp[m - 1][0] << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |