# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22702 | STARBUCKS (#40) | Fully Generate (KRIII5_FG) | C++98 | 9 ms | 8248 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;
#define ll long long
int main ()
{
int n; cin >> n;
if(n > 1e6)
{
cout << -1 << endl;
return 0;
}
vector<int> v(4);
v[1] = 1;
v[2] = 2;
v[3] = 2;
int c = 0;
int prv = 0;
for(int i=3; v.size()<=n; i++)
{
c = v[i];
while(c--) v.push_back(i);
}
ll r = 1;
for(int i=1; i<=n; i++)
{
r = (r * v[i]) % 1000000007;
}
cout <<r << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |