mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-08-21 18:52:07 +00:00
update
This commit is contained in:
parent
4bf80bde68
commit
4b54a56f4f
50
src/8/16/P7078.cpp
Normal file
50
src/8/16/P7078.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iostream>
|
||||||
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using ll = int64_t;
|
||||||
|
|
||||||
|
ll t;
|
||||||
|
bool isfirst = true;
|
||||||
|
|
||||||
|
void solve(){
|
||||||
|
ll n;
|
||||||
|
std::cin>>n;
|
||||||
|
static std::vector<ll> a;
|
||||||
|
a.resize(n+1);
|
||||||
|
if(isfirst){
|
||||||
|
isfirst=false;
|
||||||
|
for(ll i=1;i<=n;i++){
|
||||||
|
std::cin>>a[i];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for(ll i=1;i<=n;i++){
|
||||||
|
ll x,y;
|
||||||
|
std::cin>>x>>y;
|
||||||
|
a[x]=y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static std::vector<std::pair<ll, ll>> na;
|
||||||
|
na.resize(a.size());
|
||||||
|
for(ll i=1;i<a.size();i++){
|
||||||
|
na[i].first = a[i];
|
||||||
|
na[i].second=i;
|
||||||
|
}
|
||||||
|
std::sort(na.begin()+1,na.end());
|
||||||
|
// for(auto[x,y]:na)std::cout<<"("<<x<<","<<y<<"),";
|
||||||
|
if(na[3].first-na[1].first>na[2].first || (na[3].first-na[1].first == na[2].first && na[3].second>na[1].second)){
|
||||||
|
std::cout<<1<<'\n';
|
||||||
|
}else{
|
||||||
|
std::cout<<3<<'\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
std::cin>>t;
|
||||||
|
while(t--){
|
||||||
|
solve();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user