# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
491620 | blue | Baloni (COCI15_baloni) | C++17 | 262 ms | 3912 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |