# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
140142 | 2019-08-02T07:41:32 Z | rdd6584 | Unifying Values (KRIII5_UV) | C++14 | 500 ms | 760 KB |
#include <cstdio> #include <algorithm> #include <memory.h> #include <iostream> using namespace std; typedef long long ll; const int MOD = 1000000007; ll vec[10000]; int dp[10001]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> vec[i]; if (i) vec[i] += vec[i - 1]; } ll ans = 0; for (int i = 0; i < n - 1; i++) { if (!vec[i] || vec[n - 1] % vec[i]) continue; if (vec[i] > 0 && vec[n - 1] < 0 || vec[i] < 0 && vec[n - 1] > 0) continue; memset(dp, 0, sizeof(dp)); dp[1] = 1; for (int j = i + 1; j < n - 1; j++) { if (!vec[j] || vec[j] % vec[i]) continue; ll t = vec[j] / vec[i]; if (t >= 2 && t <= 10000) dp[t] = (dp[t] + dp[t - 1]) % MOD; } ll t = vec[n - 1] / vec[i]; if (t >= 2 && t <= 10000) ans = (ans + dp[t - 1]) % MOD; } if (vec[n - 1] == 0) { ll sum = 1; for (int i = 0; i < n - 1; i++) if (vec[i] == 0) sum = (sum << 1) % MOD; sum += MOD - 1; ans = (ans + sum) % MOD; } printf("%lld", ans % MOD); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 508 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 7 ms | 504 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 5 ms | 504 KB | Output is correct |
10 | Correct | 32 ms | 504 KB | Output is correct |
11 | Correct | 25 ms | 504 KB | Output is correct |
12 | Correct | 44 ms | 504 KB | Output is correct |
13 | Correct | 10 ms | 504 KB | Output is correct |
14 | Correct | 8 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 532 KB | Output is correct |
16 | Correct | 9 ms | 504 KB | Output is correct |
17 | Correct | 7 ms | 504 KB | Output is correct |
18 | Correct | 45 ms | 504 KB | Output is correct |
19 | Execution timed out | 655 ms | 520 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 504 KB | Output is correct |
2 | Correct | 6 ms | 504 KB | Output is correct |
3 | Correct | 4 ms | 504 KB | Output is correct |
4 | Correct | 52 ms | 504 KB | Output is correct |
5 | Correct | 86 ms | 504 KB | Output is correct |
6 | Correct | 49 ms | 508 KB | Output is correct |
7 | Correct | 19 ms | 508 KB | Output is correct |
8 | Correct | 6 ms | 504 KB | Output is correct |
9 | Correct | 17 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 4 ms | 504 KB | Output is correct |
14 | Correct | 5 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 504 KB | Output is correct |
16 | Correct | 5 ms | 636 KB | Output is correct |
17 | Correct | 7 ms | 632 KB | Output is correct |
18 | Correct | 8 ms | 632 KB | Output is correct |
19 | Correct | 3 ms | 504 KB | Output is correct |
20 | Execution timed out | 647 ms | 760 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |