제출 #727498

#제출 시각아이디문제언어결과실행 시간메모리
727498beaconmcHotel (CEOI11_hot)C++14
20 / 100
1482 ms60180 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; #define FOR(i, x, y) for(ll i=x; i<y; i++) #define FORNEG(i, x, y) for(ll i=x; i>y; i--) #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) //{capacity, cost} vector<vector<ll>> stuff; vector<ll> profit; int main(){ ll n,m,o; cin >> n >> m >> o; FOR(i,0,n){ ll a,b; cin >> a >> b; stuff.push_back({b,1,a}); } FOR(i,0,m){ ll a,b; cin >> a >> b; stuff.push_back({b,0,a}); } sort(stuff.begin(), stuff.end()); ll cur = 0; FOR(i,0,stuff.size()){ if (i!=0 && stuff[i][2] != stuff[i-1][2]){ cur++; } stuff[i][0] = cur; } sort(stuff.begin(), stuff.end()); reverse(stuff.begin(), stuff.end()); multiset<ll> idk; for (auto&i : stuff){ if (i[1] == 0 && idk.size() > 0){ profit.push_back(i[2]-(*idk.begin())); idk.erase(*idk.begin()); }else if (i[1] == 1){ idk.insert(i[2]); } } sort(profit.begin(), profit.end()); reverse(profit.begin(), profit.end()); ll ans = 0; FOR(i,0,min((ll) o, (ll) profit.size())){ ans += max(profit[i],(ll) 0); } cout << ans; }

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

hot.cpp: In function 'int main()':
hot.cpp:8:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   32 |   FOR(i,0,stuff.size()){
      |       ~~~~~~~~~~~~~~~~             
hot.cpp:32:3: note: in expansion of macro 'FOR'
   32 |   FOR(i,0,stuff.size()){
      |   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...