답안 #499915

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499915 2021-12-30T01:25:09 Z RandomLB Rabbit Carrot (LMIO19_triusis) C++17
100 / 100
26 ms 4536 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<double, double> point;
typedef tuple<int, int, int> tp;  //-------LL
typedef unordered_set<ll> uset;
typedef priority_queue<pll, vector<pll>, greater<pll>> djk;
typedef long long C;
typedef complex<C> P;
#define pb push_back
#define ms(a,b) memset(a,b,sizeof(a))
#define maxE(a) *max_element(a, a+sizeof(a)/sizeof(a[0]))
#define minE(a) *min_element(a, a+sizeof(a)/sizeof(a[0]))
#define F first
#define S second
#define siz(a) (int)a.size()
#define len(a) (int)a.length()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bits(x) __builtin_popcount(x)
#define vvll vector<vector<ll>>
#define FOR(a, n) for (int a = 0; a < n; a++)
#define fin(s) {cout << s << "\n"; return;}
#define finm(s) {cout << s << "\n"; return 0;}
#define X real()
#define Y imag()
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cout << vars << " = ";
    string delim = "";
    (..., (cout << delim << values, delim = ", "));
    cout << endl;
}
template<class T>
istream& operator >> (istream& is, complex<T>& p) {
  T value;
  is >> value; p.real(value);
  is >> value; p.imag(value);
  return is;
}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const double pie = 2*acos(0.0);
//------------------------------------------------------------
vector<int> v, lis;

int main(){
    cin.tie(0)->sync_with_stdio(0);
    //freopen("test.txt", "r", stdin);
    int n, m; cin >> n >> m;
    for (int i = 1; i <= n; i++){
        int a; cin >> a;
        if (a <= i*m) v.pb(a-i*m);
    }
    for (int i = 0; i < siz(v); i++){
        auto it = upper_bound(all(lis), -v[i]);
        if (it == lis.end()) lis.pb(-v[i]);
        else *it = -v[i];
    }
    cout << n-siz(lis) << "\n";
}

/* stuff you should look for
	* int overflow, array bounds
	* test case inputs don't carry over (DON'T RETURN EARLY)
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 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 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 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 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 312 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 312 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 328 KB Output is correct
26 Correct 1 ms 324 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 312 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 328 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 1 ms 312 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 0 ms 312 KB Output is correct
34 Correct 1 ms 316 KB Output is correct
35 Correct 1 ms 320 KB Output is correct
36 Correct 1 ms 324 KB Output is correct
37 Correct 1 ms 324 KB Output is correct
38 Correct 1 ms 316 KB Output is correct
39 Correct 1 ms 324 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 328 KB Output is correct
42 Correct 1 ms 320 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 312 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 312 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 1 ms 312 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 312 KB Output is correct
44 Correct 18 ms 3100 KB Output is correct
45 Correct 19 ms 2196 KB Output is correct
46 Correct 25 ms 2712 KB Output is correct
47 Correct 26 ms 2704 KB Output is correct
48 Correct 17 ms 3572 KB Output is correct
49 Correct 20 ms 3748 KB Output is correct
50 Correct 23 ms 3696 KB Output is correct
51 Correct 24 ms 4536 KB Output is correct
52 Correct 19 ms 2832 KB Output is correct
53 Correct 17 ms 1604 KB Output is correct
54 Correct 20 ms 3648 KB Output is correct
55 Correct 19 ms 3640 KB Output is correct