답안 #1101165

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1101165 2024-10-15T17:14:08 Z vladilius Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
1000 ms 1360 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second
const int mod = 1e9 + 7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n; cin>>n;
    vector<int> h(n + 1);
    for (int i = 1; i <= n; i++){
        cin>>h[i];
    }
    vector<int> w(n + 1);
    for (int i = 1; i <= n; i++){
        cin>>w[i];
    }
    
    ll out = 0;
    for (int i = 1; i <= n; i++){
        out += ((1LL * w[i] * (w[i] + 1) / 2) % mod * (1LL * h[i] * (h[i] + 1) / 2) % mod) % mod;
        int x = h[i];
        for (int j = i + 1; j <= n; j++){
            x = min(x, h[j]);
            out += ((1LL * w[i] * w[j]) % mod * (1LL * x * (x + 1) / 2) % mod) % mod;
        }
        out %= mod;
    }
    cout<<out<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 3 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Execution timed out 1060 ms 1360 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 3 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 4 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 3 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -