Submission #1135125

#TimeUsernameProblemLanguageResultExecution timeMemory
1135125brianhdzmdoRarest Insects (IOI22_insects)C++20
Compilation error
0 ms0 KiB
#include "insects.h" #include <bits/stdc++.h> #define all(a) (a).begin(), (a).end() #define allr(a) (a).rbegin(), (a).rend() #define ll long long #define lli long long int #define fr(i, a, b) for (ll i = a; i < b; i++) #define fr1(i, a, b) for (ll i = a - 1; i >= b; i--) #define fi first #define se second #define mp(j, k) make_pair(j, k) #define pb(x) push_back(x) #define pbp(x, y) push_back({x, y}) #define in(x) insert(x) #define vec vector<ll> #define vecb vector<bool> #define vecp vector<pair<ll, ll>> #define vecv vector<vector<ll>> #define yes cout << "YES\n"; #define no cout << "NO\n"; #define ac 1e-7 #define fauto(a) \ for (auto i : a) \ cout << i << " "; #define fautop(a) \ for (auto i : a) \ cout << i.fi << " " << i.se << endl; void move_inside(int i) { } void move_outside(int i) { } int press_button(); int min_cardinality(int N) { int ans = 0; int minf = 1; int maxf = 0; int currf = LLONG_MAX; multiset<int> mst; fr(i, 0, N) { move_inside(i); maxf = press_button(); mst.insert(maxf); if(currf < maxf) { mst.erase(mst.find(currf)); minf = *mst.begin(); } else if(maxf > minf) { mst.erase(mst.find(minf)); minf = *mst.begin(); } currf = maxf; } return minf; return 0; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:49:15: warning: overflow in conversion from 'long long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   49 |   int currf = LLONG_MAX;
      |               ^~~~~~~~~
insects.cpp:51:3: error: 'multiset' was not declared in this scope
   51 |   multiset<int> mst;
      |   ^~~~~~~~
insects.cpp:51:3: note: suggested alternatives:
In file included from /usr/include/c++/11/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:87,
                 from insects.cpp:2:
/usr/include/c++/11/bits/stl_set.h:70:11: note:   'std::multiset'
   70 |     class multiset;
      |           ^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:87,
                 from insects.cpp:2:
/usr/include/c++/11/set:80:13: note:   'std::pmr::multiset'
   80 |       using multiset = std::multiset<_Key, _Cmp, polymorphic_allocator<_Key>>;
      |             ^~~~~~~~
insects.cpp:51:12: error: expected primary-expression before 'int'
   51 |   multiset<int> mst;
      |            ^~~
insects.cpp:58:5: error: 'mst' was not declared in this scope
   58 |     mst.insert(maxf);
      |     ^~~