update
This commit is contained in:
parent
b7c267cb3c
commit
74f4918910
@ -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)
|
||||
add_executable(P1003 ${CMAKE_CURRENT_LIST_DIR}/P1003/P1003.cpp)
|
||||
|
||||
add_executable(P1311 ${CMAKE_CURRENT_LIST_DIR}/P1311/P1311.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<<i+1<<"\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<<(ans==0?-1:ans)<<"\n";
|
||||
|
||||
}
|
24
P1311/P1311.cpp
Normal file
24
P1311/P1311.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <ranges>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user