10052022-02-22 12:31:20sjRészekre (40)cpp11Time limit exceeded 0/40554ms5976 KiB
//njudge
#include<bits/stdc++.h>
using namespace std;
#define DBG

int main() {
	int n;cin>>n;
	vector<int> sor(n);
	for(int i=0;i<n;i++) {
		cin>>sor[i];
		#ifdef DBG
		cerr<<"I'm debugging with the shopping cart\n";
		#endif
	}
	map<int,int> lengths;
	#ifdef DBG
	cerr<<"map init ok\n";
	#endif
	for(int i=0;i<n;i++) {
		
		#ifdef DBG
		cerr<<i<<' ';
		#endif
		
		auto pos=lengths.lower_bound(sor[i]);
		
		#ifdef DBG
		cerr<<(*pos).first;
		cerr<<' ';
		#endif
		
		//for(auto it=pos;pos!=lengths.end()&&it!=lengths.end();it++) {
		if(pos!=lengths.end()) {
			#ifdef DBG
			cerr<<"f\n";
			#endif
			auto it=pos;
			(*it).second++;
		}
		
		#ifdef DBG
		cerr<<sor[i]<<'\n';
		#endif
		
		if(lengths[sor[i]]==0) lengths[sor[i]]=1;
		
	}
	int mx=-1;
	for(pair<int,int> e : lengths) {
		mx=max(mx,e.second);
		
		#ifdef DBG
		cerr<<e.first<<' '<<e.second<<'\n';
		#endif
	}
	cout<<mx;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/02ms1740 KiB
2Time limit exceeded0/0552ms3712 KiB
3Wrong answer0/22ms2520 KiB
4Wrong answer0/23ms2536 KiB
5Wrong answer0/28ms2552 KiB
6Wrong answer0/316ms2580 KiB
7Wrong answer0/346ms2828 KiB
8Wrong answer0/375ms3060 KiB
9Wrong answer0/3162ms3576 KiB
10Time limit exceeded0/3503ms4068 KiB
11Time limit exceeded0/3507ms4484 KiB
12Time limit exceeded0/3554ms5352 KiB
13Time limit exceeded0/4546ms5504 KiB
14Time limit exceeded0/4547ms5740 KiB
15Time limit exceeded0/5540ms5976 KiB