1 solutions

  • 0
    @ 2022-2-11 10:25:35

    不知道对不对,先存这里

    #include <bits/stdc++.h>
    using namespace std;
    vector<int>v[200000];
    int main(){
    	int n,x,ans=0;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		scanf("%d",&x);
    		for(int i=0;;i++){
    			if(v[i].empty()){
    				ans++;
    				v[i].push_back(x);
    				break;
    			}
    			else{
    				if(x<=v[i][v[i].size()-1]){
    					v[i].push_back(x);
    					break;
    				}
    			}
    		}
    	}
    	cout<<ans;
    	return 0;
    }
    • 1

    Information

    ID
    1107
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    0
    Uploaded By