제출 #878855

#제출 시각아이디문제언어결과실행 시간메모리
878855KN200711학생 (COCI14_studentsko)C++14
100 / 100
2 ms348 KiB
# include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d %d", &N, &K); vector<int> A(N); vector< pair<int, int> > arr(N); for(int i=0;i<N;i++) { scanf("%d", &A[i]); arr[i] = make_pair(A[i], i); } sort(arr.begin(), arr.end()); for(int i=0;i<N;i++) { A[arr[i].second] = i / K; } vector<int> Y; Y.clear(); for(int i=0;i<N;i++) { if(Y.size() == 0 || Y.back() <= A[i]) Y.push_back(A[i]); else { int V = upper_bound(Y.begin(), Y.end(), A[i]) - Y.begin(); Y[V] = A[i]; } } printf("%d\n", N - Y.size()); }

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

studentsko.cpp: In function 'int main()':
studentsko.cpp:28:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   28 |  printf("%d\n", N - Y.size());
      |          ~^     ~~~~~~~~~~~~
      |           |       |
      |           int     std::vector<int>::size_type {aka long unsigned int}
      |          %ld
studentsko.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d %d", &N, &K);
      |  ~~~~~^~~~~~~~~~~~~~~~~
studentsko.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   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...