Submission #619150

# Submission time Handle Problem Language Result Execution time Memory
619150 2022-08-02T10:15:25 Z Hanksburger Rabbit Carrot (LMIO19_triusis) C++17
14 / 100
5 ms 540 KB
#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, a=0, ans=1e9;
    cin >> n >> m;
    s.insert({0, 0});
    s.insert({1e9, 1e9});
    for (int i=1; i<=n; i++)
    {
        int x, y;
        cin >> x;
        a+=m;
        y=(*s.lower_bound({x-a, -1e9})).second;
        auto itr=s.lower_bound({x-a, -1e9});
        if (y-1<(*itr).second)
        {
            int 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 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 240 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 240 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 3 ms 460 KB Output is correct
21 Correct 4 ms 540 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 3 ms 464 KB Output is correct
24 Correct 5 ms 468 KB Output is correct
25 Incorrect 2 ms 468 KB Output isn't correct
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 4 ms 540 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 468 KB Output is correct
9 Incorrect 2 ms 468 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 4 ms 540 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 464 KB Output is correct
8 Correct 5 ms 468 KB Output is correct
9 Incorrect 2 ms 468 KB Output isn't correct
10 Halted 0 ms 0 KB -