# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
255861 | 2020-08-02T02:23:34 Z | shrek12357 | 학생 (COCI14_studentsko) | C++14 | 54 ms | 760 KB |
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> nums(n); vector<pair<int, int>> order(n); map<int, int> groups; for (int i = 0; i < n; i++) { int temp; cin >> temp; nums[i] = temp; order[i].first = temp; } sort(nums.begin(), nums.end()); for (int i = 0; i < n; i++) { groups[nums[i]] = (i / k + 1); } for (int i = 0; i < n; i++) { order[i].second = groups[order[i].first]; } int smallest = 0; vector<int> ans(n); ans[0] = 1; for (int i = 1; i < n; i++) { ans[i] = 1; for (int j = 0; j < i; j++) { if (order[i].second >= order[j].second && ans[i] < ans[j] + 1) { ans[i] = ans[j] + 1; } } } int best = 0; for (int i = 0; i < n; i++) { best = max(best, ans[i]); } cout << n - best << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 676 KB | Output is correct |
2 | Correct | 41 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 640 KB | Output is correct |
2 | Correct | 49 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 640 KB | Output is correct |
2 | Correct | 43 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 724 KB | Output is correct |
2 | Correct | 47 ms | 760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 640 KB | Output is correct |
2 | Correct | 52 ms | 640 KB | Output is correct |