제출 #255861

#제출 시각아이디문제언어결과실행 시간메모리
255861shrek12357학생 (COCI14_studentsko)C++14
100 / 100
54 ms760 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

studentsko.cpp: In function 'int main()':
studentsko.cpp:32:6: warning: unused variable 'smallest' [-Wunused-variable]
  int smallest = 0;
      ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...