# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577524 | 2022-06-15T03:46:05 Z | temporary_juggernaut | Fancy Fence (CEOI20_fancyfence) | C++14 | 1000 ms | 1216 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]; 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]); 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; for(int j=i+1;j<=n;j++){ umin(mn,1ll*h[j]); ll cn2=w[j]; ans+=(((cn*cn2)%mod)*((mn*(mn+1)/2ll)%mod))%mod; ans%=mod; } } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 18 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 13 ms | 320 KB | Output is correct |
3 | Execution timed out | 1076 ms | 1216 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 212 KB | Output is correct |
2 | Execution timed out | 1078 ms | 340 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 16 ms | 212 KB | Output is correct |
3 | Execution timed out | 1086 ms | 340 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 18 ms | 316 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 316 KB | Output is correct |
8 | Correct | 13 ms | 340 KB | Output is correct |
9 | Correct | 16 ms | 340 KB | Output is correct |
10 | Correct | 17 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 316 KB | Output is correct |
12 | Correct | 4 ms | 316 KB | Output is correct |
13 | Correct | 18 ms | 212 KB | Output is correct |
14 | Correct | 17 ms | 344 KB | Output is correct |
15 | Correct | 16 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 18 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 16 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 308 KB | Output is correct |
10 | Correct | 12 ms | 212 KB | Output is correct |
11 | Execution timed out | 1077 ms | 1216 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |