# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854402 | 2023-09-27T10:03:40 Z | pliam | Fancy Fence (CEOI20_fancyfence) | C++17 | 122 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; #define MAXN 100005 typedef long long ll; #define MOD (ll)1e9+7 #define INF (ll)2e9 /* Brute force N^4 */ int N, L; ll h[MAXN], w[MAXN]; vector<ll> nh; int main(){ scanf("%d",&N); for(int i=0;i<N;i++){ scanf("%lld",&h[i]); } for(int i=0;i<N;i++){ scanf("%lld",&w[i]); for(int j=0;j<w[i];j++){ L++; nh.push_back(h[i]); } } ll ans=0; for(int i=0;i<L;i++){ // printf("%lld\n", nh[i]); for(int j=0; j<=i; j++){ //[j,i], find minimum m and answer is m*(m+1)/2 ll m=INF; for(int k=j;k<=i;k++){ m = min(m, nh[k]); } ans += (m*(m+1))/2LL; ans %= MOD; } } printf("%lld\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Runtime error | 106 ms | 262144 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 108 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Runtime error | 107 ms | 262144 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Runtime error | 105 ms | 262144 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
3 | Halted | 0 ms | 0 KB | - |