# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
175552 | illiboy1212 | 방 배정하기 (KOI17_room) | C++14 | 2 ms | 256 KiB |
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 <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
int n, m;
pair <int, int> arr[110];
pair <int ,int> brr[110];
pair<int,int> dp[1000000];
int main()
{
int siz = 0;
int k;
int max = 0;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++)
{
scanf("%d %d %d %d", &arr[i].first, &arr[i].second, &brr[i].first, &brr[i].second);
}
for (int i = 0; i < n; i++)
{
k=0;
for (int j = 0; j <= siz ; j++)
{
if (dp[j].first + arr[i].first > m)
{
}
else
{
k++;
dp[siz+k].first = dp[j].first+arr[i].first;
dp[siz+k].second = dp[j].second + arr[i].second;
}
if (dp[j].first + brr[i].first > m)
{
}
else
{
k++;
dp[siz+k].first = dp[j].first+brr[i].first;
dp[siz+k].second = dp[j].second + brr[i].second;
}
}
siz+=k;
}
for (int i = 0; i <= siz; i++)
{
if (dp[i].second > max)
{
max = dp[i].second;
}
}
printf("%d", max);
}
Compilation message (stderr)
# | 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... |