Submission #619153

# Submission time Handle Problem Language Result Execution time Memory
619153 2022-08-02T10:16:30 Z Hanksburger Rabbit Carrot (LMIO19_triusis) C++17
14 / 100
3 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
set<pair<long long, long long> > s;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n, m, a=0, ans=1e18;
    cin >> n >> m;
    s.insert({0, 0});
    s.insert({1e18, 1e18});
    for (long long i=1; i<=n; i++)
    {
        long long x, y;
        cin >> x;
        a+=m;
        y=(*s.lower_bound({x-a, -1e18})).second;
        auto itr=s.lower_bound({x-a, -1e18});
        if (y-1<(*itr).second)
        {
            long long fi=(*itr).first, se=(*itr).second;
            s.erase(itr);
            if (x-a==fi)
                s.insert({fi, y-1});
            else
            {
                s.insert({fi, se});
                s.insert({x-a, y-1});
            }
        }
    }
    for (auto itr=s.begin(); itr!=s.end(); itr++)
        ans=min(ans, itr->second+n);
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 2 ms 596 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 3 ms 596 KB Output is correct
24 Correct 3 ms 596 KB Output is correct
25 Incorrect 2 ms 596 KB Output isn't correct
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Incorrect 2 ms 596 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Incorrect 2 ms 596 KB Output isn't correct
10 Halted 0 ms 0 KB -