# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959873 | 2024-04-09T09:08:04 Z | penguin133 | Fancy Fence (CEOI20_fancyfence) | C++17 | 5 ms | 4696 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pi pair <int, int> #define pii pair <int, pi> int n, H[100005], W[100005], P[100005]; stack <pi> s; int lst[105]; const int mod = 1e9 + 7; void solve(){ cin >> n; for(int i = 1; i <= n; i++)cin >> H[i]; for(int i = 1; i <= n; i++)cin >> W[i]; s.push({0, 0}); int ans = 0; for(int i = 1; i <= n; i++){ P[i] = P[i - 1] + W[i]; for(int j = H[i] + 1; j <= 100; j++)lst[j] = P[i]; for(int j = 1; j <= H[i]; j++){ ans += j * W[i] % mod * (P[i - 1] - lst[j]) % mod; ans %= mod; int a = W[i] * (W[i] + 1) / 2; a %= mod; a *=j; a %= mod; ans += a; ans %= mod; } //cout << ans << '\n'; } cout << ans; } main(){ ios::sync_with_stdio(0);cin.tie(0); int tc = 1; //cin >> tc; while(tc--)solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Runtime error | 5 ms | 4696 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2392 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 2 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 4564 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2396 KB | Output is correct |
2 | Runtime error | 5 ms | 4696 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2648 KB | Output is correct |
2 | Runtime error | 5 ms | 4664 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Runtime error | 5 ms | 4696 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |