답안 #871402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871402 2023-11-10T17:38:17 Z Trisanu_Das Fancy Fence (CEOI20_fancyfence) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int N, L;
ll h[100005], w[100005];
vector<ll> nh;

int main(){
    cin >> n;
    for(int i=0;i<N;i++) cin >> h[i];
    for(int i=0;i<N;i++){
        cin >> w[i];
        for(int j=0;j<w[i];j++){
            L++;
            nh.push_back(h[i]);
        }
    }
    ll ans=0;
    for(int i=0;i<L;i++){
        for(int j=0; j<=i; j++){
            ll m=INF;
            for(int k=j;k<=i;k++) m = min(m, nh[k]);
            ans += (m*(m+1))/2LL;
            ans %= MOD;
        }
    }
    cout << ans << '\n';
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:10:12: error: 'n' was not declared in this scope; did you mean 'nh'?
   10 |     cin >> n;
      |            ^
      |            nh
fancyfence.cpp:22:18: error: 'INF' was not declared in this scope
   22 |             ll m=INF;
      |                  ^~~
fancyfence.cpp:25:20: error: 'MOD' was not declared in this scope
   25 |             ans %= MOD;
      |                    ^~~