# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
175552 | illiboy1212 | 방 배정하기 (KOI17_room) | C++14 | 2 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (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... |