結果

問題 No.871 かえるのうた
ユーザー chocoruskchocorusk
提出日時 2019-08-30 21:30:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,040 bytes
コンパイル時間 863 ms
コンパイル使用メモリ 107,772 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 16:46:32
合計ジャッジ時間 3,710 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;

int main()
{
	int n, k; cin>>n>>k;
	ll l[100010], r[100010];
	ll x[100010], a[100010];
	for(int i=0; i<n; i++){
		cin>>x[i];
	}
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	k--;
	vector<P> v(n);
	for(int i=0; i<n; i++){
		v[i]=P(x[i]+a[i], i);
	}
	sort(v.begin(), v.end());
	int cnt=1;
	bool nuo=0;
	if(k==v[0].second) nuo=1;
	for(int i=1; i<n; i++){
		int t=v[i].second, s=v[i-1].second;
		if(x[t]-a[t]>x[s]+a[s]){
			if(nuo){
				cout<<cnt<<endl;
				return 0;
			}
			cnt=1;
		}else{
			cnt++;
		}
		if(k==t) nuo=1; 
	}
	cout<<cnt<<endl;
	
	return 0;
}
0