제출 #1228954

#제출 시각아이디문제언어결과실행 시간메모리
1228954nvt2k9Art Exhibition (JOI18_art)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 5e5 + 5;
int n;
pair<int,int> a[N];
int pre[N];
signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n;
  for(int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
  sort(a + 1, a + n + 1);
  for(int i = 1; i <= n; i++){
    pre[i]=pre[i-1]+ a[i].second;
  }
  int gm = 0, res = 0;
  // S = 
  for(int i = 1; i <= n; i++){
    amin= max(gm, a[i].first - pre[i-1]);
    res = max(res, pre[i] - a[i].first + amin);
  }
  cout << res << "\n";
}

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

art.cpp: In function 'int main()':
art.cpp:20:5: error: 'amin' was not declared in this scope; did you mean 'main'?
   20 |     amin= max(gm, a[i].first - pre[i-1]);
      |     ^~~~
      |     main