제출 #1196506

#제출 시각아이디문제언어결과실행 시간메모리
1196506HydrolyzedRabbit Carrot (LMIO19_triusis)C++20
100 / 100
18 ms2492 KiB
#include <algorithm>
#include <cstdio>
#include <vector>

long long x;
std::vector<long long> lis;

signed main(int argc, char *argv[]) {
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i=1; i<=n; ++i) {
		scanf("%lld", &x);
		x = m * i - x;
		
		if(x < 0ll) {
			continue ;
		}
		auto it = std::upper_bound(lis.begin(), lis.end(), x);
		if(it == lis.end()) {
			lis.emplace_back(x);
		}
		else {
			*it = x;
		}
	}

	printf("%d", n - (int) lis.size());
	return 0;
}

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

triusis.cpp: In function 'int main(int, char**)':
triusis.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d %d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~
triusis.cpp:12:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |                 scanf("%lld", &x);
      |                 ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...