# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
3257 |
2013-08-29T15:32:33 Z |
joonas |
앱 (KOI13_app) |
C++ |
|
0 ms |
1672 KB |
#include <iostream>
#include <algorithm>
using namespace std;
int Costs[100], Mbyte[100], res[100];
int main(){
int i, j, N, M;
cin >> N >> M;
for(i=0; i < N; ++i){
cin >> Mbyte[i];
res[i] = Mbyte[i];
}
for(i=0; i < N; ++i){
cin >> Costs[i];
res[i] += Costs[i];
}
for(i=0; i < N; ++i){
for(j=0; j < N; ++j){
if( res[i] < res[j] ){
swap( Costs[i], Costs[j] );
swap( Mbyte[i], Mbyte[j] );
swap( res[i], res[j] );
} else if( res[i] == res[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){
if( Msum < M ){
Msum += res[i];
Csum += Costs[i];
} else {
cout<< Csum <<'\n';
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1672 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |