# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
534864 | mjhmjh1104 | Fancy Fence (CEOI20_fancyfence) | C++17 | 9 ms | 4224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
const int MOD = 1e9 + 7;
int n, h[1006], w[1006], res, a[1006][1006];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", h + i);
for (int i = 0; i < n; i++) scanf("%d", w + i);
for (int i = 0; i < n; i++) res = (res + 1LL * (1LL * w[i] * (w[i] + 1) / 2 % MOD) * (1LL * h[i] * (h[i] + 1) / 2 % MOD) % MOD) % MOD;
for (int i = 0; i < n; i++) {
a[i][i] = h[i];
for (int j = i + 1; j < n; j++) a[i][j] = min(h[j], a[i][j - 1]);
}
for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) res = (res + 1LL * w[i] * w[j] % MOD * (1LL * a[i][j] * (a[i][j] + 1) / 2 % MOD) % MOD) % MOD;
printf("%d", res);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |