Submission #74402

# Submission time Handle Problem Language Result Execution time Memory
74402 2018-08-31T16:08:26 Z nixys Studentsko (COCI14_studentsko) C++11
0 / 100
6 ms 1012 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;

typedef pair <int, int> pii;
typedef long long ll;

const int inf = 1e9 + 1;
const double eps = 1e-9;
const int MAXN = 1e5 + 1;

int n, k;
int a[MAXN];
vector <pii> v;
vector <int> najmanji;

int main(){

    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        v.pb(mp(a[i], i));
    }

    sort(v.begin(), v.end());

    for (int i = 0; i < n; i++)
        a[v[i].se] = (i/k)+1;

    najmanji.pb(-inf);

    for (int i = 0; i < n; i++){
        vector<int>::iterator it = upper_bound(najmanji.begin(), najmanji.end(), a[i]);
        if (it == najmanji.end()) najmanji.pb(a[i]);
        najmanji[it-najmanji.begin()] = a[i];
    }

    cout << n - najmanji.size() + 1;

    return 0;

}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 800 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 960 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -