# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22512 | 2017-04-30T05:13:44 Z | 2000/4000(#946, 0xrgb) | Unifying Values (KRIII5_UV) | C++14 | 9 ms | 1992 KB |
#include <cstdio> #include <map> using namespace std; const int MAXN = 10004; const int P = 1000 * 1000 * 1000 + 7; typedef long long lli; int N; lli S[MAXN]; lli D[MAXN]; map<lli,int> dp; int main() { scanf("%d", &N); for (int i = 1; i <= N; ++i) { scanf("%lld", &D[i]); S[i] += S[i - 1] + D[i]; } int cnt = 0; for (int i = 1; i < N; ++i) { // 1 ~ i const lli st = S[i] - S[0]; if (S[N] % st != 0) continue; dp.clear(); dp[S[N]] = 1; for (int j = N - 1; j > i; --j) { auto it = dp.find(S[j] + st); if (it == dp.end()) continue; else dp[S[j]] = (dp[S[j]] + it->second) % P; } cnt = (cnt + dp[S[i] + st]) % P; } printf("%d\n", cnt); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1332 KB | Output is correct |
2 | Correct | 0 ms | 1332 KB | Output is correct |
3 | Correct | 0 ms | 1332 KB | Output is correct |
4 | Correct | 9 ms | 1992 KB | Output is correct |
5 | Correct | 9 ms | 1992 KB | Output is correct |
6 | Runtime error | 0 ms | 1332 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 1332 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |