This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
int k;
void min(int &n,vector<int>&h,vector<int>&w,int x,int y,int nodo,int z){
if(z==k){
if(x*y<n&& z==k){
n=x*y;
}
return;
}
if(nodo<h.size()){
min(n,h,w,x,y,nodo+1,z);
x+=w[nodo];
y=max(y,h[nodo]);
min(n,h,w,x,y,nodo+1,z+1);
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n>>k;
vector<int>w(n);
vector<int>h(n);
for(int i=0;i<n;i++){
cin>>w[i]>>h[i];
}
int r=1e9;
vector<int>a;
min(r,h,w,0,0,0,0);
cout<<r;
return 0;
}
Compilation message (stderr)
kisik.cpp: In function 'void min(int&, std::vector<int>&, std::vector<int>&, int, int, int, int)':
kisik.cpp:20:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | if(nodo<h.size()){
| ~~~~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |