답안 #534864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534864 2022-03-09T04:59:16 Z mjhmjh1104 Fancy Fence (CEOI20_fancyfence) C++17
30 / 100
9 ms 4224 KB
#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);
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
fancyfence.cpp:11:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 0; i < n; i++) scanf("%d", h + i);
      |                                 ~~~~~^~~~~~~~~~~~~
fancyfence.cpp:12:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 0; i < n; i++) scanf("%d", w + i);
      |                                 ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 6 ms 4172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 8 ms 4172 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4172 KB Output is correct
2 Runtime error 1 ms 332 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 6 ms 4120 KB Output is correct
3 Runtime error 1 ms 332 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 7 ms 4224 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 7 ms 4220 KB Output is correct
9 Correct 6 ms 4172 KB Output is correct
10 Correct 6 ms 4172 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 2 ms 2252 KB Output is correct
13 Correct 6 ms 4172 KB Output is correct
14 Correct 6 ms 4172 KB Output is correct
15 Correct 6 ms 4220 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 6 ms 4172 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 7 ms 4220 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 9 ms 4172 KB Output is correct
11 Incorrect 0 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -