提出 #9754931


ソースコード 拡げる

/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,d,a;
		cin>>n>>d>>a;
		vector<pii> v(n);
		for(ll int i=0;i<n;i++)
		{
			cin>>v[i].F>>v[i].S;
			v[i].S=(v[i].S+a-1)/a;
		}
		sort(all(v));
		int pre[n+1],sm=0;
		memset(pre,0,sizeof(pre));
		ll int ans=0;
		for(int i=n-1;i>=0;i--)
		{
			pii p={v[i].F-2*d,-hell};
			ll int lidx=lower_bound(all(v),p)-v.begin();
			ll int left=v[i].S+sm;
			if(left>0)
			{
				ans+=left;
				pre[lidx]+=left;
				sm-=left;
			}
			sm+=pre[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

提出情報

提出日時
問題 F - Silver Fox vs Monster
ユーザ bhj2001
言語 C++14 (GCC 5.4.1)
得点 600
コード長 1538 Byte
結果 AC
実行時間 70 ms
メモリ 4224 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 3
AC × 25
セット名 テストケース
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, max_01, max_02, max_03, max_04, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, random_13, random_14, random_15, random_16, sample_01, sample_02, sample_03
ケース名 結果 実行時間 メモリ
hand_01 AC 1 ms 256 KiB
hand_02 AC 1 ms 256 KiB
max_01 AC 69 ms 4224 KiB
max_02 AC 70 ms 4224 KiB
max_03 AC 52 ms 4224 KiB
max_04 AC 52 ms 4224 KiB
random_01 AC 21 ms 1408 KiB
random_02 AC 9 ms 768 KiB
random_03 AC 60 ms 3712 KiB
random_04 AC 39 ms 2560 KiB
random_05 AC 65 ms 3968 KiB
random_06 AC 33 ms 2304 KiB
random_07 AC 5 ms 512 KiB
random_08 AC 61 ms 3840 KiB
random_09 AC 10 ms 768 KiB
random_10 AC 37 ms 2432 KiB
random_11 AC 4 ms 512 KiB
random_12 AC 25 ms 1792 KiB
random_13 AC 42 ms 2816 KiB
random_14 AC 15 ms 1152 KiB
random_15 AC 61 ms 3840 KiB
random_16 AC 60 ms 3712 KiB
sample_01 AC 1 ms 256 KiB
sample_02 AC 1 ms 256 KiB
sample_03 AC 1 ms 256 KiB