Submission #597190

#TimeUsernameProblemLanguageResultExecution timeMemory
597190Trisanu_DasHotel (CEOI11_hot)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; #define ll long long; #define vll vector<long long>; #define pll pair<long long, long long>; #define sz(x) int(x.size()) int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, o; cin >> n >> m >> o; multiset<pll> rooms; for(int i = 1; i <= n; i++){ ll c, p; cin >> c >> p; rooms.insert({p, c}); } vector<pll> offers(m); for(int j = 0; j < m; j++)cin >> offers[j].second >> offers[j].first; sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;}); ll res = 0; vector<ll> options; for(pll z : offers){ ll capreq = z.first; ll gain = z.second; auto f = rooms.lower_bound({capreq, -1}); if(f == rooms.end()) continue; if(gain > f->second) options.push_back(gain - f->second); rooms.erase(f); } sort(options.begin(), options.end()); for(int i = sz(options)-1; i >= 0 && i >= sz(options)-o; i--) res += options[i]; cout << res << '\n'; }

Compilation message (stderr)

hot.cpp: In function 'int main()':
hot.cpp:9:13: error: template argument 1 is invalid
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:15:11: note: in expansion of macro 'pll'
   15 |  multiset<pll> rooms;
      |           ^~~
hot.cpp:9:13: error: template argument 2 is invalid
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:15:11: note: in expansion of macro 'pll'
   15 |  multiset<pll> rooms;
      |           ^~~
hot.cpp:9:13: error: template argument 3 is invalid
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:15:11: note: in expansion of macro 'pll'
   15 |  multiset<pll> rooms;
      |           ^~~
hot.cpp:15:14: error: expected primary-expression before '>' token
   15 |  multiset<pll> rooms;
      |              ^
hot.cpp:15:16: error: 'rooms' was not declared in this scope
   15 |  multiset<pll> rooms;
      |                ^~~~~
hot.cpp:7:17: error: declaration does not declare anything [-fpermissive]
    7 | #define ll long long;
      |                 ^~~~
hot.cpp:17:3: note: in expansion of macro 'll'
   17 |   ll c, p;
      |   ^~
hot.cpp:17:6: error: 'c' was not declared in this scope
   17 |   ll c, p;
      |      ^
hot.cpp:17:9: error: 'p' was not declared in this scope
   17 |   ll c, p;
      |         ^
hot.cpp:9:13: error: template argument 1 is invalid
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:21:9: note: in expansion of macro 'pll'
   21 |  vector<pll> offers(m);
      |         ^~~
hot.cpp:9:13: error: template argument 2 is invalid
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:21:9: note: in expansion of macro 'pll'
   21 |  vector<pll> offers(m);
      |         ^~~
hot.cpp:21:12: error: expected primary-expression before '>' token
   21 |  vector<pll> offers(m);
      |            ^
hot.cpp:21:14: error: 'offers' was not declared in this scope
   21 |  vector<pll> offers(m);
      |              ^~~~~~
hot.cpp:9:39: error: expected ')' before ';' token
    9 | #define pll pair<long long, long long>;
      |                                       ^
hot.cpp:23:41: note: in expansion of macro 'pll'
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                         ^~~
hot.cpp:23:40: note: to match this '('
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                        ^
hot.cpp: In lambda function:
hot.cpp:9:39: error: expected '{' before ';' token
    9 | #define pll pair<long long, long long>;
      |                                       ^
hot.cpp:23:41: note: in expansion of macro 'pll'
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                         ^~~
hot.cpp: In function 'int main()':
hot.cpp:9:39: error: expected ')' before ';' token
    9 | #define pll pair<long long, long long>;
      |                                       ^
hot.cpp:23:41: note: in expansion of macro 'pll'
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                         ^~~
hot.cpp:23:6: note: to match this '('
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |      ^
hot.cpp:23:45: error: 'U' was not declared in this scope
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                             ^
hot.cpp:9:39: error: expected primary-expression before ';' token
    9 | #define pll pair<long long, long long>;
      |                                       ^
hot.cpp:23:48: note: in expansion of macro 'pll'
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                                ^~~
hot.cpp:23:52: error: 'V' was not declared in this scope
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                                    ^
hot.cpp:23:83: error: expected primary-expression before ')' token
   23 |  sort(offers.begin(), offers.end(), [] (pll U, pll V){return U.second > V.second;});
      |                                                                                   ^
hot.cpp:7:17: error: declaration does not declare anything [-fpermissive]
    7 | #define ll long long;
      |                 ^~~~
hot.cpp:24:2: note: in expansion of macro 'll'
   24 |  ll res = 0;
      |  ^~
hot.cpp:24:5: error: 'res' was not declared in this scope
   24 |  ll res = 0;
      |     ^~~
hot.cpp:7:17: error: template argument 1 is invalid
    7 | #define ll long long;
      |                 ^~~~
hot.cpp:25:9: note: in expansion of macro 'll'
   25 |  vector<ll> options;
      |         ^~
hot.cpp:7:17: error: template argument 2 is invalid
    7 | #define ll long long;
      |                 ^~~~
hot.cpp:25:9: note: in expansion of macro 'll'
   25 |  vector<ll> options;
      |         ^~
hot.cpp:25:11: error: expected primary-expression before '>' token
   25 |  vector<ll> options;
      |           ^
hot.cpp:25:13: error: 'options' was not declared in this scope
   25 |  vector<ll> options;
      |             ^~~~~~~
hot.cpp:9:13: error: declaration does not declare anything [-fpermissive]
    9 | #define pll pair<long long, long long>;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
hot.cpp:26:6: note: in expansion of macro 'pll'
   26 |  for(pll z : offers){
      |      ^~~
hot.cpp:26:10: warning: range-based 'for' loops with initializer only available with '-std=c++2a' or '-std=gnu++2a'
   26 |  for(pll z : offers){
      |          ^
hot.cpp:26:12: error: found ':' in nested-name-specifier, expected '::'
   26 |  for(pll z : offers){
      |            ^
      |            ::
hot.cpp:26:10: error: 'z' has not been declared
   26 |  for(pll z : offers){
      |          ^
hot.cpp:35:2: error: expected primary-expression before 'for'
   35 |  for(int i = sz(options)-1; i >= 0 && i >= sz(options)-o; i--)
      |  ^~~
hot.cpp:34:39: error: expected ')' before 'for'
   34 |  sort(options.begin(), options.end());
      |                                       ^
      |                                       )
   35 |  for(int i = sz(options)-1; i >= 0 && i >= sz(options)-o; i--)
      |  ~~~                                   
hot.cpp:26:5: note: to match this '('
   26 |  for(pll z : offers){
      |     ^