結果

問題 No.871 かえるのうた
ユーザー KuraKura
提出日時 2019-09-16 20:43:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,194 bytes
コンパイル時間 1,067 ms
コンパイル使用メモリ 92,184 KB
実行使用メモリ 4,848 KB
最終ジャッジ日時 2023-09-21 08:06:17
合計ジャッジ時間 5,774 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 3 ms
4,376 KB
testcase_10 RE -
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 36 ms
4,576 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 AC 32 ms
4,700 KB
testcase_18 AC 7 ms
4,384 KB
testcase_19 WA -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 AC 2 ms
4,384 KB
testcase_24 RE -
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 4 ms
4,376 KB
testcase_27 AC 4 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 14 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 18 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 8 ms
4,380 KB
testcase_35 AC 17 ms
4,380 KB
testcase_36 AC 24 ms
4,440 KB
testcase_37 AC 15 ms
4,380 KB
testcase_38 AC 32 ms
4,700 KB
testcase_39 WA -
testcase_40 RE -
testcase_41 AC 1 ms
4,380 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 RE -
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 1 ms
4,388 KB
権限があれば一括ダウンロードができます

ソースコード

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