# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22850 | 2017-04-30T07:51:48 Z | 이대회 트래쉬 대회에야옹(#967, dofwk1526, HUIDONG, mincl) | Fully Generate (KRIII5_FG) | C++ | 500 ms | 41756 KB |
#include <iostream> #include <cstdio> #include <map> using namespace std; map<long long, long long> mp; int main() { long long n; long long sum = 0; scanf("%lld", &n); if (n == 1) { cout << 1; return 0; } mp[1] = 1; sum += mp[1]; long long i,j; long long mul =1; for (i = 2; i <= n; i++) { mp[i] = 1 + mp[i - mp[mp[i - 1]]]; sum += mp[i]; if(sum > n) { sum -= mp[i]; while(1) { if(sum == n) break; mul = (mul*i)%1000000007; sum++; } } else { for(j=0; j<mp[i]; j++) { mul = (mul*i)%1000000007; } } } cout << mul << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2024 KB | Output is correct |
2 | Correct | 0 ms | 2024 KB | Output is correct |
3 | Correct | 0 ms | 2024 KB | Output is correct |
4 | Correct | 0 ms | 2024 KB | Output is correct |
5 | Correct | 0 ms | 2024 KB | Output is correct |
6 | Correct | 0 ms | 2024 KB | Output is correct |
7 | Correct | 0 ms | 2024 KB | Output is correct |
8 | Correct | 0 ms | 2024 KB | Output is correct |
9 | Correct | 0 ms | 2024 KB | Output is correct |
10 | Correct | 0 ms | 2024 KB | Output is correct |
11 | Correct | 169 ms | 10868 KB | Output is correct |
12 | Execution timed out | 500 ms | 41756 KB | Execution timed out |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2024 KB | Output is correct |
2 | Correct | 0 ms | 2024 KB | Output is correct |
3 | Correct | 0 ms | 2024 KB | Output is correct |
4 | Correct | 0 ms | 2024 KB | Output is correct |
5 | Correct | 0 ms | 2024 KB | Output is correct |
6 | Correct | 0 ms | 2024 KB | Output is correct |
7 | Correct | 0 ms | 2024 KB | Output is correct |
8 | Correct | 0 ms | 2024 KB | Output is correct |
9 | Correct | 0 ms | 2024 KB | Output is correct |
10 | Correct | 0 ms | 2024 KB | Output is correct |
11 | Correct | 169 ms | 10868 KB | Output is correct |
12 | Execution timed out | 500 ms | 41756 KB | Execution timed out |
13 | Halted | 0 ms | 0 KB | - |