diff --git a/CMakeLists.txt b/CMakeLists.txt index 56840c1..dd96344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,4 +26,6 @@ add_executable(P2615 ${CMAKE_CURRENT_LIST_DIR}/P2615/P2615.cpp) add_executable(P7076 ${CMAKE_CURRENT_LIST_DIR}/P7076/P7076.cpp) add_executable(P7075 ${CMAKE_CURRENT_LIST_DIR}/P7075/P7075.cpp) -add_executable(P1003 ${CMAKE_CURRENT_LIST_DIR}/P1003/P1003.cpp) \ No newline at end of file +add_executable(P1003 ${CMAKE_CURRENT_LIST_DIR}/P1003/P1003.cpp) + +add_executable(P1311 ${CMAKE_CURRENT_LIST_DIR}/P1311/P1311.cpp) \ No newline at end of file diff --git a/P1003/P1003.cpp b/P1003/P1003.cpp index abcc33e..632caf7 100644 --- a/P1003/P1003.cpp +++ b/P1003/P1003.cpp @@ -13,7 +13,6 @@ const int MAX_N = 1e4+5; int n; Point dir; Point arr[MAX_N][2]; -int ans; int main(){ std::iostream::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); @@ -26,13 +25,11 @@ int main(){ } cin>>dir.x>>dir.y; - for(const int i:range(0,n)){ - if(arr[i][0].x<=dir.x && dir.x <= arr[i][1].x - && arr[i][0].y<=dir.y && dir.y <= arr[i][1].y){ - ans++; + for(int i=n-1;i>=0;i--){ + if(arr[i][0].x<=dir.x && dir.x <= arr[i][0].x+arr[i][1].x + && arr[i][0].y<=dir.y && dir.y <= arr[i][0].y+arr[i][1].y){ + std::cout< +#include +#include + +using std::iostream,std::cin,std::cout; +constexpr const auto range = std::ranges::views::iota; + +const int MAX_N {(size_t)2e5+5},MAX_COLOR {50+5}; +int n,k,p; +int ans; +struct Hotel{ + int color,min_cost; +}hotel[MAX_N]; + +int main(){ + iostream::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); + + cin>>n>>k>>p; + for(const int i:range(1,n+1)){ + cin>>hotel[i].color>>hotel[i].min_cost; + } + + +} \ No newline at end of file