TLE怎么办
查看原帖
TLE怎么办
722012
Amiee1103楼主2022/10/3 17:17

大佬们我该怎么解决TLE呢

#include<bits/stdc++.h>
using namespace std;
long long a[100000000];
int main(){
	int n,temp=1,maxn=-11110;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	} 
	for(int i=1;i<n;i++){
		int j=i;
		while(a[j]<a[j+1]){
			temp++;
			j++;
		}
		if(temp>maxn){
			maxn=temp;
		}
		temp=1;
	}
	cout<<maxn;
	return 0;
}
2022/10/3 17:17
加载中...