제출 #40624

#제출 시각아이디문제언어결과실행 시간메모리
40624HassoonyStudentsko (COCI14_studentsko)C++14
0 / 100
1 ms456 KiB
#include<bits/stdc++.h> #include<unordered_map> using namespace std; typedef unsigned long long ll; typedef double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=5009; int n,k,a[MX],dp[MX][MX]; int DP(int x,int y){ if(x==n)return 0; int &ret=dp[x][y];if(ret!=-1)return ret; ret=DP(x+1,y); if(a[x]>=y)ret=max(ret,DP(x+1,a[x])+1); return ret; } map<int,int>hashy; int main(){ scanf("%d%d",&n,&k); for(int i=0;i<n;i++)scanf("%d",&a[i]),hashy[a[i]]=1; int tt=1,j=1; for(auto pp:hashy){ hashy[pp.first]=tt; if(j%k==0)++tt; j++; } for(int i=0;i<n;i++)a[i]=hashy[a[i]]; memset(dp,-1,sizeof(dp)); printf("%d\n",n-DP(0,0)); }

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

studentsko.cpp: In function 'int main()':
studentsko.cpp:19:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&k);
                        ^
studentsko.cpp:20:56: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%d",&a[i]),hashy[a[i]]=1;
                                                        ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...