# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445050 | 2021-07-16T10:18:46 Z | osmanallazov | Fancy Fence (CEOI20_fancyfence) | C++14 | 106 ms | 1956 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; int main(){ // SUBTASK 4---->SOLUTION ll n,z,s=0,f=0; ll res=0; ll mod=1e9+7; cin>>n; ll h[n+1]; ll w[n+1]; for(int i=1;i<=n;i++){ cin>>h[i]; } for(int i=1;i<=n;i++){ cin>>w[i]; if(w[i]!=1){ f=1; } } if(f==0){ for(int i=1;i<=n;i++){ ll mini=h[i]; for(int j=i;j>=1;j--){ mini=min(mini,h[j]); res+=((mini*(mini+1))/2); } } cout<<res; return 0; } h[0]=0; for(int i=n;i>=1;i--) { s=(s+w[i])%mod ; ll o =((h[i]*(h[i]+1))/2)%mod ; o= ((o - ((h[i-1]*(h[i-1]+1))/2)%mod) + mod)%mod ; ll p=((s*(s+1))/2)%mod ; res=(res+((o*p)%mod))%mod ; } cout<<res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 304 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 9 ms | 640 KB | Output is correct |
3 | Correct | 44 ms | 1172 KB | Output is correct |
4 | Correct | 89 ms | 1868 KB | Output is correct |
5 | Correct | 93 ms | 1956 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 10 ms | 440 KB | Output is correct |
4 | Correct | 45 ms | 972 KB | Output is correct |
5 | Correct | 95 ms | 1740 KB | Output is correct |
6 | Correct | 106 ms | 1828 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 10 ms | 332 KB | Output is correct |
9 | Correct | 61 ms | 1048 KB | Output is correct |
10 | Correct | 84 ms | 1740 KB | Output is correct |
11 | Correct | 88 ms | 1836 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |