Submission #175552

#TimeUsernameProblemLanguageResultExecution timeMemory
175552illiboy1212방 배정하기 (KOI17_room)C++14
0 / 100
2 ms256 KiB
#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)

room.cpp: In function 'int main()':
room.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
room.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d %d", &arr[i].first, &arr[i].second, &brr[i].first, &brr[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...