結果

問題 No.871 かえるのうた
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2019-09-14 02:14:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,743 bytes
コンパイル時間 1,727 ms
コンパイル使用メモリ 92,648 KB
実行使用メモリ 5,684 KB
最終ジャッジ日時 2023-09-17 21:56:48
合計ジャッジ時間 5,413 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 14 ms
4,380 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 113 ms
5,316 KB
testcase_15 AC 113 ms
5,684 KB
testcase_16 AC 122 ms
5,320 KB
testcase_17 AC 100 ms
5,316 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 10 ms
4,376 KB
testcase_21 AC 44 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 6 ms
4,376 KB
testcase_27 AC 10 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 35 ms
4,384 KB
testcase_30 AC 65 ms
5,220 KB
testcase_31 AC 4 ms
4,376 KB
testcase_32 AC 54 ms
5,228 KB
testcase_33 WA -
testcase_34 AC 20 ms
4,376 KB
testcase_35 AC 52 ms
4,380 KB
testcase_36 AC 72 ms
5,128 KB
testcase_37 AC 45 ms
4,380 KB
testcase_38 AC 99 ms
5,424 KB
testcase_39 WA -
testcase_40 AC 30 ms
5,104 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 31 ms
5,060 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

vector<int> uf, usz;
int nc;

void init(int n){
  vector<int> uf_(n);
  vector<int> usz_(n, 1);
  uf = uf_;
  usz = usz_;
  nc = n;

  for(int i = 0; i < uf.size(); i++){
    uf[i] = i;
  }
}

int find(int a){
  return (uf[a] == a) ? a : uf[a] = find(uf[a]);
}

void union_(int a, int b){
  a = find(a);
  b = find(b);

  if(a != b){
    if(usz[a] >= usz[b]){
      swap(a, b);
    }
    uf[a] = b;
    usz[b] += usz[a];
    nc--;
  }
}

int check(int a, int b){
  return (find(a) == find(b)) ? 1 : 0;
}

int get_size(int a){
  return usz[find(a)];
}

int main() {
	ll n,k;
	cin>>n>>k;
	k--;
	vector<ll> vx,va;
	rep(i,0,n){
		ll a;
		cin>>a;
		vx.pb(a);
	}
	rep(i,0,n){
		ll a;
		cin>>a;
		va.pb(a);
	}
	ll ans1 = 0;
	ll ans2 = 0;
	ll mx = vx[k]+va[k];
	rep(i,k+1,n){
		if(vx[i]<=mx)ans1++;
		else break;
		mx = max(mx,vx[i]+va[i]);
	}
	ll mn = vx[k]-va[k];
	per(i,0,k){
		if(mn<=vx[i])ans2++;
		else break;
		mn = min(mn,vx[i]-va[i]);
	}
	cout << ans1+ans2+1 << endl;
	return 0;
}
0