# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22412 | PurpleNoon backward compatibility (#40) | Fully Generate (KRIII5_FG) | C++14 | 500 ms | 10324 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 <cstdio>
#include <queue>
using namespace std;
typedef long long lint;
lint mod = 1000000007;
const int N = 1000006;
queue < lint > q;
int main() {
lint n = 1;
scanf("%lld", &n);
lint cnt = 5;
q.push(3);
q.push(3);
//printf("1 2 2 ");
lint ans = 4;
for (lint i = 4; i <= n; ++i) {
lint tmp = q.front();
q.pop();
ans = (ans*tmp) % mod;
for (int j = 0; j < tmp; ++j) {
q.push(i);
++cnt;
if (cnt > N)break;
}
}
if (n == 1)
puts("1");
else if (n == 2)
puts("2");
else if (n == 3)
puts("4");
else
printf("%lld\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |