# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577529 | 2022-06-15T03:53:29 Z | temporary_juggernaut | Fancy Fence (CEOI20_fancyfence) | C++14 | 39 ms | 1856 KB |
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; typedef long long ll; typedef long double ld; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef juggernaut #define printl(args...) printf(args) #else #define printl(args...) 0 #endif int h[100005]; int w[100005]; ll pref[100005]; int n; ll mod=1e9+7; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&h[i]); for(int i=1;i<=n;i++){ scanf("%d",&w[i]); pref[i]=pref[i-1]; pref[i]+=w[i]; } ll ans=0; for(int i=1;i<=n;i++){ ll mn=h[i]; ll cn=w[i]; ans+=(((cn*(cn+1)/2ll)%mod)*((mn*(mn+1)/2ll)%mod))%mod; ans%=mod; ans+=(mn*(mn+1)/2ll)%mod*cn%mod*((pref[n]-pref[i])%mod)%mod; ans%=mod; } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 3 ms | 468 KB | Output is correct |
3 | Correct | 13 ms | 980 KB | Output is correct |
4 | Correct | 39 ms | 1840 KB | Output is correct |
5 | Correct | 26 ms | 1736 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 3 ms | 468 KB | Output is correct |
4 | Correct | 14 ms | 980 KB | Output is correct |
5 | Correct | 27 ms | 1840 KB | Output is correct |
6 | Correct | 27 ms | 1856 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 3 ms | 468 KB | Output is correct |
9 | Correct | 15 ms | 1084 KB | Output is correct |
10 | Correct | 29 ms | 1760 KB | Output is correct |
11 | Correct | 26 ms | 1768 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 300 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |