Submission #10710

# Submission time Handle Problem Language Result Execution time Memory
10710 2014-11-09T14:05:22 Z tncks0121 Studentsko (COCI14_studentsko) C++14
0 / 100
56 ms 1836 KB
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;

vector<pii> a;
vector<int> tb;

int N, K;

int main() {
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    int x; cin >> x;
    a.push_back(pii(x, i));
  }
  sort(a.begin(), a.end());
  
  
  vector<int> pos(N);
  for(int i = 0; i < N; i++) {
    pos[a[i].second] = i / K;
  }
  
  int ans = 0;
  for(int i = 0; i < N; i++) {
    int opt = 0;
    for(int j = 0; j < i; j++) if(pos[j] <= pos[i]) opt = max(opt, pos[j]);
    tb.push_back(opt + 1);
    ans = max(opt+1, ans);
  }
  
  printf("%d", N - ans);
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1836 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1836 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -