답안 #475535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475535 2021-09-22T19:10:10 Z nohaxjustsoflo Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;


const int mxN = 5e5+5;
const int mod = 998244353;
const int mxlogN = 20;
const int mxK = 26;


int a[mxN];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m; cin >> n >> m;
    map<int, int> mp;
    mp[0] = 0;
    int incall = 0;
    int bonus = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        int x = a[i];
        auto it = mp.lower_bound(x-m-incall);
        if(it != mp.end())
        {
            mp[x-m-incall] = it->second-1;
            auto jt = mp.lower_bound(x-incall);
            auto pre = prev(jt);
            while(jt != mp.begin() && pre->second >= jt->second)
            {
                mp.erase(pre);
                pre = prev(it);
            }
        }
        incall += m;
        bonus++;
    }
    cout << mp.begin()->second+bonus << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Runtime error 1 ms 332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Runtime error 1 ms 332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Runtime error 1 ms 332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Runtime error 1 ms 332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -