이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define F first
#define S second
#define ent '\n'
#define int long long
#define pb push_back
typedef long double ld;
typedef long long ll;
using namespace std;
const int maxn = 1e6+12;
const int T = 0;
const int mod = 1e9+7;
int n,m,k,x,y,l,r;
int a[maxn],b[maxn],p[maxn],pref[maxn],fact[maxn];
void solve(){
cin>>n;
int cnt=0;
set<int>st;
for(int i=1;i<=n;i++){
cin>>a[i];
st.insert(a[i]);
}
for(int i=1;i<=n;i++){
cin>>b[i];
cnt+=(b[i]==1);
}
if(cnt==n){
cout<<st.size();
return;
}
// abs(x[i] - x[j]) <= abs(y[i] - y[j]);
int cal=0;
map<int,int>mp;
for(int i=1;i<=n;i++){
if(!mp[i]){
cal++;
for(int j=i+1;j<=n;j++){
if(abs(a[i]-a[j]) <= (b[i]-b[j])){
mp[j]=1;
}
}
}
}
cout<<cal;
}
//BEKSULTAN TOP
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
if(T)cin>>t;
while(t--)solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |