Submission #654133

#TimeUsernameProblemLanguageResultExecution timeMemory
654133Mohammad_ParsaFinancial Report (JOI21_financial)C++14
0 / 100
4075 ms5096 KiB
#include<bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define F first #define S second #define pb push_back const int N=3e5+7; int dp[10][N],v[N],a[N]; map<int,int> mp; vector<int> vec; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,d; cin>>n>>d; for(int i=0;i<n;i++){ cin>>a[i];vec.pb(a[i]); } sort(vec.begin(),vec.end()); vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end()))); for(int i=0;i<vec.size();i++){ v[i]=vec[i]; mp[vec[i]]=i; } dp[0][mp[a[0]]]=1; for(int i=1;i<n;i++){ fill(dp[i&1],dp[i&1]+N,0); dp[i&1][mp[a[i]]]=1; int ind=mp[a[i]]; for(int k=0;k<vec.size();k++){ if(a[i]>v[k]) dp[i&1][ind]=max(dp[i&1][ind],dp[(i-1)&1][k]+1); else dp[i&1][k]=max(dp[i&1][k],dp[(i-1)&1][k]); } } int ans=0; for(int i=0;i<vec.size();i++){ ans=max(ans,dp[(n-1)&1][i]); } cout<<ans; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<vec.size();i++){
      |                 ~^~~~~~~~~~~
Main.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for(int k=0;k<vec.size();k++){
      |                     ~^~~~~~~~~~~
Main.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i=0;i<vec.size();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...