제출 #747416

#제출 시각아이디문제언어결과실행 시간메모리
747416ibshaArt Exhibition (JOI18_art)C++17
0 / 100
0 ms212 KiB
/* ⢀⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀⠀⠀⢀⢴⣶⣆ ⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦⣴⣾⠁⠸⣼⡿ ⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟⠉⠀⠀⠀⠀⠀ ⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣶⣮⣭⣽⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⠿⠿⠿⠿⠛⠉ */ #include <bits/stdc++.h> using namespace std; #define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define MOD 1000000007 #define endl '\n' #define pb(v,i) (v).push_back(i) #define vll vector<ll> #define pll pair<ll,ll> typedef long long ll; __int128 fastpow(ll base,ll exp){__int128 result=1;while (exp){if (exp%2==1) result*=base;exp/=2;base*=base;}return result;} bool isprime(ll x){for (ll i=2;i*i<=x;i++){if (x%i==0) return 0;}return 1;} // bool issorted(auto i, auto j){ i++; for (;i!=j;i++){if (*i<*(i-1)) return 0;}return 1;} bool cmp(ll i, ll j){ return i>j;}; bool cmp2(pll i, pll j){ // for task specific sorts if (i.first==j.first) return i.second > j.second; return i.first<j.first; } signed main(){ fastio ll n; cin >> n; pll a[n]; ll ans=0; ll sum=0; for (int i=0;i<n;i++){ cin >> a[i].first >> a[i].second; sum+=a[i].second; } sort(a,a+n,cmp2); ll l=0,r=n-1; while (l<=r){ ans=max(ans,sum-(a[r].first-a[l].first)); ll ml,mr; ml=sum-a[l].second-(a[r].first,a[l+1].first); mr=sum-a[r].second-(a[r-1].first,a[l].first); if (ml>mr){ l++; } else r--; } cout << ans; }

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

art.cpp: In function 'int main()':
art.cpp:59:30: warning: left operand of comma operator has no effect [-Wunused-value]
   59 |     ml=sum-a[l].second-(a[r].first,a[l+1].first);
      |                         ~~~~~^~~~~
art.cpp:60:32: warning: left operand of comma operator has no effect [-Wunused-value]
   60 |     mr=sum-a[r].second-(a[r-1].first,a[l].first);
      |                         ~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...