結果

問題 No.871 かえるのうた
ユーザー KuraKura
提出日時 2019-09-16 20:43:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,194 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 95,500 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 02:31:56
合計ジャッジ時間 3,955 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 15 RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define fion(n) fixed<<setprecision(n)
#define endl "\n"
#define OR ||
#define AND &&
#define NOT !
#define line(s) getline(cin,s)
#define yuque priority_queue
#define MOD 1000000007ll
#define START int main(){cin.tie(0);ios::sync_with_stdio(false);
#define END }
using namespace std;
START
ll n,k;cin>>n>>k;
vector<ll> x(n),a(n);
rep(i,0,n)cin>>x[i];
rep(i,0,n)cin>>a[i];
ll m=k-1,c=k,ma;
while(634){
	if(c<n AND x[m]+a[m]>=x[c])ma=x[c]+a[c];
	else break;
	while(x[m]+a[m]>=x[c]){
		if(x[c]+a[c]>=ma){
			m=c;
			ma=x[c]+a[c];
		}
		c++;
	}
}
m=k-1;ll b=k-2,mi;
while(315){
	if(b>-1 AND x[m]-a[m]<=x[b])mi=x[b]-a[b];
	else break;
	while(x[m]-a[m]<=x[b]){
		if(x[b]-a[b]<=mi){
			m=b;
			mi=x[b]-a[b];
		}
		b--;
	}
}
cout<<c-b-1<<endl;
END
0