Submission #491620

#TimeUsernameProblemLanguageResultExecution timeMemory
491620blueBaloni (COCI15_baloni)C++17
100 / 100
262 ms3912 KiB
#include <iostream> #include <vector> #include <set> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; multiset<int> arr; for(int i = 1; i <= N; i++) { int H; cin >> H; // cerr << "curr set: "; // for(int a:arr) cerr << a << ' '; // cerr << '\n'; if(arr.find(H) == arr.end()) { // cerr << "inserting " << H-1 << '\n'; arr.insert(H-1); } else { arr.erase(arr.find(H)); arr.insert(H-1); // cerr << "dropping to " << H-1 << '\n'; } } cout << int(arr.size()) << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...