답안 #963032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963032 2024-04-14T11:33:40 Z anton Fancy Fence (CEOI20_fancyfence) C++17
30 / 100
1000 ms 2396 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long
#define pii pair<int,int>

const int MAX_N = 1e5;
const int mod =1e9+7;

int h[MAX_N];
int w[MAX_N];

int nbp(int u){
    return (u*(u+1LL)/2LL)%mod;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n; 
    cin>>n;
    for(int i = 0; i<n; i++){
        cin>>h[i];
    }
    for(int i = 0; i<n; i++){
        cin>>w[i];
    }

    int res= 0;
    
    for(int l = 0; l<n; l++){
        int minh= h[l];
        for(int r = l; r<n; r++){
            minh= min(minh, h[r]);
            if(r!=l){
                res = (res+((nbp(minh) * w[l])%mod)*w[r])%mod;
            }
            else{
                res=(res+ (nbp(minh) * nbp(w[l]))%mod)%mod;
            }
        }
    }

    cout<<res<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 4 ms 476 KB Output is correct
3 Execution timed out 1073 ms 1628 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 352 KB Output is correct
2 Correct 310 ms 800 KB Output is correct
3 Execution timed out 1063 ms 2396 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 292 ms 604 KB Output is correct
4 Execution timed out 1044 ms 2140 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 432 KB Output is correct
8 Correct 3 ms 472 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 2 ms 352 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 5 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 1 ms 352 KB Output is correct
4 Correct 4 ms 520 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 352 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 4 ms 500 KB Output is correct
11 Execution timed out 1090 ms 1728 KB Time limit exceeded
12 Halted 0 ms 0 KB -