| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1143970 | THXuan | 학생 (COCI14_studentsko) | C++20 | 1096 ms | 836 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define INF 1e9
using namespace std;
typedef long long ll;
void solve()
{
int n, k; cin >> n >> k;
vector<ll>v(n), a;
for (int i = 0; i < n; i++) {
cin >> v[i];
a.push_back(v[i]);
}
sort(v.begin(), v.end());
map<ll, int>vis;
for (int i = 0; i < n; i++) {
vis[v[i]] = i / k;
}
vector<int>dp(n + 5, 1);
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (vis[a[j]] <= vis[a[i]])dp[i] = max(dp[i], dp[j] + 1);
}
}
int ans = 0;
for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
cout << n - ans << "\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1; //cin>>t;
while (t--) solve();
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
