Submission #1115076

# Submission time Handle Problem Language Result Execution time Memory
1115076 2024-11-20T02:20:55 Z duytuandao21 Studentsko (COCI14_studentsko) C++17
0 / 100
2 ms 2640 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 2e6 + 7;
typedef pair<int, int> pii;

int n, k;
int a[N];
pair<int, int> b[N];
map<int, int> pos;

bool cmp(const pii x, const pii y) {
    return x.first > y.first;
}
signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> b[i].first;
        b[i].second = i;
    }
    sort (b + 1, b + 1 + n, cmp);
    int cnt = 0;
    for (int i = 1; i <= n; i += k) {
        ++cnt;
        for (int j = i; j <= i + k - 1; j++) a[b[j].second] = cnt;
    }
    int maxVal = 0, res = 0;
    for (int i = n; i > 0; i--) {
        maxVal = max(maxVal, a[i]);
        if (a[i] < maxVal) res++;
    }
    cout << res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -