제출 #701317

#제출 시각아이디문제언어결과실행 시간메모리
701317Zezo_AmrArt Exhibition (JOI18_art)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<pair<int,int>>v2;
    for(int i=0; i<n; i++)
    {
        double long x,y;
        cin>>x>>y;
        v.push_back({x,y});
        v2.push_back({y-x,i});
    }
    sort(v2.begin(),v2.end(),greater<pair<int,int>>());
    int c,mxm=-10000000000000000,s=0,mx=-10000000000000000,mn=10000000000000000;
    for(int i=0; i<n; i++)
    {
        int x=v2[i].second;
        s+=v[x].second;
        mx=max(mx,v[x].first);
        mn=min(mn,v[x].first);
        c=s-(mx-mn);
        if(c>mxm)
        {
            mxm=c;
        }

    }
    cout<<mxm<<'\n';
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'int main()':
art.cpp:19:9: error: 'v' was not declared in this scope
   19 |         v.push_back({x,y});
      |         ^
art.cpp:27:12: error: 'v' was not declared in this scope
   27 |         s+=v[x].second;
      |            ^