update
This commit is contained in:
parent
c31e0b08dd
commit
998e27437d
@ -1,24 +1,31 @@
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <ranges>
|
||||
#include<iostream>
|
||||
|
||||
using std::iostream,std::cin,std::cout;
|
||||
constexpr const auto range = std::ranges::views::iota;
|
||||
using std::cin,std::cout,std::iostream;
|
||||
|
||||
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];
|
||||
const int MAX_COLOR = 50+5;
|
||||
|
||||
int price,color,n,k,p,last_coffee_shop,last_hotel[MAX_COLOR],left_hotel_num[MAX_COLOR],cnt_hotel_num[MAX_COLOR],ans;
|
||||
|
||||
int main(){
|
||||
iostream::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
|
||||
iostream::sync_with_stdio(false),cin.tie(0),cout.tie(0);
|
||||
|
||||
cin>>n>>k>>p;
|
||||
for(const int i:range(1,n+1)){
|
||||
cin>>hotel[i].color>>hotel[i].min_cost;
|
||||
|
||||
for(int i=1;i<=n;i++){
|
||||
cin>>color>>price;
|
||||
|
||||
if(price<=p){
|
||||
last_coffee_shop = i;
|
||||
}
|
||||
|
||||
if(last_hotel[color] <= last_coffee_shop){
|
||||
left_hotel_num[color] = cnt_hotel_num[color];
|
||||
}
|
||||
|
||||
last_hotel[color]=i;
|
||||
ans+=left_hotel_num[color];
|
||||
cnt_hotel_num[color]++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
cout<<ans<<"\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user