제출 #942204

#제출 시각아이디문제언어결과실행 시간메모리
942204artixkrishna학생 (COCI14_studentsko)C++14
100 / 100
3 ms900 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3+10; int n; int a[maxn], aux[maxn]; int lis(void) { vector<int> v; for (int i = 1; i <= n; i++) { vector<int>::iterator it = upper_bound(v.begin(), v.end(), a[i]); if (it == v.end()) v.push_back(a[i]); else *it = a[i]; } return v.size(); } int main(void) { int k; scanf("%d %d", &n, &k); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); aux[i] = a[i]; } sort(aux+1, aux+n+1); map<int, int> group; for (int i = 1; i <= n; i++) group[aux[i]] = (i-1)/k; for (int i = 1; i <= n; i++) a[i] = group[a[i]]; printf("%d\n", n-lis()); }

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

studentsko.cpp: In function 'int main()':
studentsko.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |  scanf("%d %d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~~
studentsko.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |   scanf("%d", &a[i]);
      |   ~~~~~^~~~~~~~~~~~~
#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...