Submission #3252

#TimeUsernameProblemLanguageResultExecution timeMemory
3252joonas앱 (KOI13_app)C++98
0 / 21
0 ms1672 KiB
#include <iostream> #include <algorithm> using namespace std; int Costs[100], Mbyte[100]; int main(){ int i, j, N, M; cin >> N >> M; for(i=0; i < N; ++i) cin >> Mbyte[i]; for(i=0; i < N; ++i) cin >> Costs[i]; for(i=0; i < N; ++i){ for(j=i+1; j < N; ++j){ if( Costs[i] > Costs[j] ){ swap( Costs[i], Costs[j] ); swap( Mbyte[i], Mbyte[j] ); } } } int Msum=0, Csum=0; for(i=0; i < N; ++i){ Msum += Mbyte[i]; Csum += Costs[i]; if( Msum >= M ){ cout<< Csum <<'\n'; break; } } return 0; }
#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...