답안 #718522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718522 2023-04-04T09:22:31 Z irmuun Boat (APIO16_boat) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(s) s.begin(),s.end()

const ll mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll a[n+5],b[n+5];
    ll dp[n+5];
    vector<pair<ll,char>>v;
    for(ll i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        v.pb({a[i],'L'});
        v.pb({b[i],'R'});
    }
    ll sum[n+5];
    sum[0]=0;
    ll cur=0;
    sort(all(v));
    map<ll,ll>s,e;
    for(ll i=0;i<2*n-1;i++){
        if(v[i]!=v[i+1]){
            ll l=v[i].ff,r=v[i+1].ff;
            if(v[i].ss=='R') l++;
            if(v[i+1].ss=='L') r--;
            if(l<=r){
                cur++;
                sum[cur]=sum[cur-1]+(r-l+1);
                s[l]=cur;
                e[r]=cur;
            }
        }
    }
    ll dp[n+5][2*n+5];
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=cur;j++){
            
        }
    }
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:43:8: error: conflicting declaration 'long long int dp [(n + 5)][((n * 2) + 5)]'
   43 |     ll dp[n+5][2*n+5];
      |        ^~
boat.cpp:18:8: note: previous declaration as 'long long int dp [(n + 5)]'
   18 |     ll dp[n+5];
      |        ^~
boat.cpp:18:8: warning: unused variable 'dp' [-Wunused-variable]