제출 #1055320

#제출 시각아이디문제언어결과실행 시간메모리
1055320YassirSalamaFinancial Report (JOI21_financial)C++17
0 / 100
4050 ms21328 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define F first #define S second const int maxn=3e5+100; #define all(v) v.begin(),v.end() signed main(){ int n,d; cin>>n>>d; vector<int> v(n); for(int i=0;i<n;i++){ cin>>v[i]; } vector<int> c=v;sort(all(c));c.erase(unique(all(c)),c.end()); map<int,int> mp;for(int i=0;i<c.size();i++) mp[c[i]]=i; int dp[n][c.size()]; memset(dp,0,sizeof(dp)); dp[0][mp[v[0]]]=1; for(int i=1;i<n;i++){ int t=mp[v[i]]; for(int k=i-1;k>=0&&k>=i-d;k--){ for(int j=0;j<c.size();j++){ if(t>j){ dp[i][t]=max(dp[i][t],dp[k][j]+1); }else{ dp[i][j]=max(dp[i][j],dp[k][j]); } } } } int ans=0; for(int i=0;i<c.size();i++) ans=max(ans,dp[n-1][i]); cout<<ans<<endl; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:16:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     map<int,int> mp;for(int i=0;i<c.size();i++) mp[c[i]]=i;
      |                                 ~^~~~~~~~~
Main.cpp:23:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int j=0;j<c.size();j++){
      |                     ~^~~~~~~~~
Main.cpp:33:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=0;i<c.size();i++) ans=max(ans,dp[n-1][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...