답안 #1108917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108917 2024-11-05T16:38:00 Z csibe_csavo Global Warming (CEOI18_glo) C++14
28 / 100
2000 ms 3136 KB
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int n,d;
int lis(vector<int> &v)
{
	vector<int> s{v[1]};
	for(int i=2; i<=n; i++)
	{
		int ind=lower_bound(s.begin(),s.end(),v[i])-s.begin();
		if(ind>=s.size()) s.push_back(v[i]);
		else s[ind]=v[i];
	}
	int p=s.size();
	return p;
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>d;
	vector<int> v(n+1);
	for(int i=1; i<=n; i++)
		cin>>v[i];
	int ans=lis(v);
	for(int i=1; i<n; i++)
	{
		v[i]-=d;
		ans=max(ans,lis(v));
	}
	cout<<ans<<"\n";
}

Compilation message

glo.cpp: In function 'int lis(std::vector<int>&)':
glo.cpp:11:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   if(ind>=s.size()) s.push_back(v[i]);
      |      ~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 13 ms 336 KB Output is correct
20 Correct 10 ms 336 KB Output is correct
21 Correct 8 ms 336 KB Output is correct
22 Correct 8 ms 336 KB Output is correct
23 Correct 9 ms 504 KB Output is correct
24 Correct 10 ms 336 KB Output is correct
25 Correct 8 ms 336 KB Output is correct
26 Correct 8 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2053 ms 3136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2067 ms 1104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2044 ms 1616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 13 ms 336 KB Output is correct
20 Correct 10 ms 336 KB Output is correct
21 Correct 8 ms 336 KB Output is correct
22 Correct 8 ms 336 KB Output is correct
23 Correct 9 ms 504 KB Output is correct
24 Correct 10 ms 336 KB Output is correct
25 Correct 8 ms 336 KB Output is correct
26 Correct 8 ms 568 KB Output is correct
27 Execution timed out 2053 ms 3136 KB Time limit exceeded
28 Halted 0 ms 0 KB -