제출 #960541

#제출 시각아이디문제언어결과실행 시간메모리
960541Trisanu_DasCake 3 (JOI19_cake3)C++17
24 / 100
4043 ms9744 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second signed main(){ int n, m; cin >> n >> m; pair<int, int> a[n]; for(int i = 0; i < n; i++) cin >> a[i].ss >> a[i].ff; sort(a, a + n); int ans = LLONG_MIN; for(int i = 0; i < n; i++){ multiset<int> s; int val = 0; for(int j = i; j < n; j++){ s.insert(a[j].ss); val += a[j].ss; if(s.size() > m){ val -= *s.begin(); s.erase(s.begin()); } if(s.size() == m) ans = max(ans, val - 2 * (a[j].ff - a[i].ff)); } } cout << ans << '\n'; }

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

cake3.cpp: In function 'int main()':
cake3.cpp:19:19: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   19 |       if(s.size() > m){
      |          ~~~~~~~~~^~~
cake3.cpp:23:19: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   23 |       if(s.size() == m) ans = max(ans, val - 2 * (a[j].ff - a[i].ff));
      |          ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...