답안 #791357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791357 2023-07-24T03:46:25 Z ttamx Fancy Fence (CEOI20_fancyfence) C++14
30 / 100
1000 ms 2004 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=1e5+5;
const ll mod=1e9+7;
const ll inv2=5e8+4;

int n;
ll h[N],w[N];
ll ans;

ll calc(ll x){
    x%=mod;
    return x*(x+1)%mod*inv2%mod;
}

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n;
    for(int i=1;i<=n;i++)cin >> h[i];
    for(int i=1;i<=n;i++)cin >> w[i];
    for(int i=1;i<=n;i++){
        ll rmq=h[i];
        ans+=calc(w[i])*calc(h[i])%mod;
        ans%=mod;
        for(int j=i-1;j>=1;j--){
            rmq=min(rmq,h[j]);
            ans+=calc(rmq)*w[i]%mod*w[j]%mod;
            ans%=mod;
        }
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 7 ms 348 KB Output is correct
3 Execution timed out 1083 ms 1620 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 599 ms 660 KB Output is correct
3 Execution timed out 1080 ms 2004 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 580 ms 668 KB Output is correct
4 Execution timed out 1057 ms 2004 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 6 ms 360 KB Output is correct
9 Correct 6 ms 356 KB Output is correct
10 Correct 6 ms 364 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 6 ms 332 KB Output is correct
14 Correct 7 ms 340 KB Output is correct
15 Correct 6 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 6 ms 340 KB Output is correct
5 Correct 1 ms 332 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 212 KB Output is correct
10 Correct 7 ms 360 KB Output is correct
11 Execution timed out 1087 ms 1616 KB Time limit exceeded
12 Halted 0 ms 0 KB -