Submission #628817

# Submission time Handle Problem Language Result Execution time Memory
628817 2022-08-13T17:38:05 Z Iwanttobreakfree Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
1000 ms 1208 KB
#include <iostream>
#include <vector>
#include <map>
#include <stack>
using namespace std;
#define int long long
const int mod=1e9+7;
signed main(){
    int n;
    cin>>n;
    vector<int> v(n),h(n);
    map<int,int> mp;
    for(int& i:h)cin>>i;
    for(int& i:v)cin>>i;
    long long ans=0;
    for(int i=0;i<n;i++){
        ans+=(((v[i]*(v[i]+1)/2)%mod)*(h[i]*(h[i]+1)/2)%mod)%mod;
        ans%=mod;
        int he=h[i];
        for(int j=i+1;j<n;j++){
            he=min(he,h[j]);
            ans+=(((v[j]*(v[i]))%mod)*(he*(he+1)/2)%mod)%mod;
            ans%=mod;
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 6 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 1 ms 212 KB Output is correct
3 Correct 0 ms 300 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 1 ms 212 KB Output is correct
2 Correct 5 ms 212 KB Output is correct
3 Execution timed out 1075 ms 1208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 6 ms 304 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 Incorrect 4 ms 312 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 Incorrect 6 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -