제출 #383347

#제출 시각아이디문제언어결과실행 시간메모리
383347Iwanttobreakfree은행 (IZhO14_bank)C++98
0 / 100
1 ms364 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,m,sum; cin>>n>>m; vector<int> sal(n); vector<int> bank(m); for(int i=0;i<n;i++)cin>>sal[i]; for(int i=0;i<m;i++)cin>>bank[i]; sort(sal.rbegin(),sal.rend()); sort(bank.rbegin(),bank.rend()); vector<vector<int> > DP(n,vector<int>(m)); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ DP[i][j]=sal[i]; if(sal[i]<bank[j])continue; else { for(int q=0;q<j;q++){ int x=DP[i][q]-bank[j]; if(x<0)x*=-1; DP[i][j]=min(x,DP[i][j]); } } } } bool pos=true; for(int i=0;i<n;i++){ if(DP[i][m-1]>0){ pos=false; break; } } if(pos)cout<<"YES"; else cout<<"NO"; }

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

bank.cpp: In function 'int main()':
bank.cpp:6:10: warning: unused variable 'sum' [-Wunused-variable]
    6 |  int n,m,sum;
      |          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...