답안 #945585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945585 2024-03-14T05:17:18 Z itslq Fancy Fence (CEOI20_fancyfence) C++17
12 / 100
1000 ms 1720 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int md(int x) {
    if (x < 0) return (x % MOD) + MOD;
    if (x < MOD) return x;
    return x % MOD;
}

signed main() {
    int N, minH, ans = 0;
    cin >> N;
    vector<int> H(N), W(N);

    for (int i = 0; i < N; i++) cin >> H[i];
    for (int i = 0; i < N; i++) cin >> W[i];

    for (int i = 0; i < N; i++) {
        minH = H[i];
        ans = md(ans + md(H[i] * (H[i] + 1) / 2) * md(W[i] * (W[i] + 1) / 2));
        for (int j = i + 1; j < N; j++) {
            minH = min(minH, H[j]);
            ans = md(ans + md(W[i] * W[j]) * (minH * (minH + 1) / 2));
        }
    }

    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 5 ms 472 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Execution timed out 1073 ms 1720 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 5 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 6 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 5 ms 472 KB Output isn't correct
3 Halted 0 ms 0 KB -