Submission #51552

#TimeUsernameProblemLanguageResultExecution timeMemory
51552tranxuanbachStudentsko (COCI14_studentsko)C++17
100 / 100
55 ms1984 KiB
#include<bits/stdc++.h> #define dibs reserve #define OVER9000 1234567890 #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++) #define tisic 47 #define soclose 1e-8 #define chocolate win // so much chocolate #define patkan 9 #define ff first #define ss second #define abs(x) ((x < 0)?-(x):x) #define uint unsigned int #define dbl long double using namespace std; // mylittledoge int main(){ cin.sync_with_stdio(0); cin.tie(0); int N, K; cin >> N >> K; vector <int> A(N); map <int, int> M; for (int i = 0; i < N; i++){ cin >> A[i]; M[A[i]] = 0; } int n = 0; ALL_THE(M,it) it->ss = n++; for (int i = 0; i < N; i++){ A[i] = M[A[i]] / K; } int ansT = 0; vector <int> ans(N, 1); for (int i = 0; i < N; i++){ for (int j = 0; j < i; j++){ if (A[j] <= A[i]) ans[i] = max(ans[i], ans[j] + 1); } ansT = max(ansT, ans[i]); } cout << N - ansT << "\n"; return 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...