제출 #1156828

#제출 시각아이디문제언어결과실행 시간메모리
1156828gulmixArt Exhibition (JOI18_art)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> int main(){ ios::sync_with_stdio(false); cin.tie(0); //ifstream cin("inputf.txt"); //ofstream cout("outputfv.txt"); ll n; cin >> n; vector<pair<ll, ll>> a(n); for(int i = 0; i < n; i++){ cin >> a[i].first >> a[i].second; } sort(all(a)); ll cur = 0; ll ans = 0; ll mn = a[0].first, mx = a[0].first; for(int i = 0; i < n; i++){ ll mn1 = min(a[i].first, mn); ll mx1 = max(a[i].first, mx); cur += a[i].second; if(cur - (mx1 - mn1) < 0){ cur = 0; mn = a[i+1].first; mx = a[i+1]first; continue; } mn = mn1; mx = mx1; ans = max(ans, cur - (mx - mn)); } cout << ans << '\n'; }

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

art.cpp: In function 'int main()':
art.cpp:30:23: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'll' {aka 'long long int'} in assignment
   30 |             mx = a[i+1]first;
      |                       ^