Submission #61608993


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
typedef pair<int,int>pii;
const int N=5e5+10;
int a[N];
int vis[N];
int n, ans;

void solve()
{
	cin >> n;
	
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	
	}
	int j = n/2+1;
	for(int i = 1; i <= n/2; i++)
	{
		if(a[i] * 2 < a[j] && j<=n)
		{
			if(j > n) break;
			ans++;
			j++;
		}
		else{
			while(a[i] * 2 > a[j] && j<=n)  j++;
			if(a[i] * 2 <= a[j])
			{
				if( j > n )break;
				ans++;
				j++;
			}
		}
					
	}
	cout<<ans;
}

signed main()
{	
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

Submission Info

Submission Time
Task E - Simultaneous Kagamimochi
User YANG666
Language C++ 20 (gcc 12.2)
Score 450
Code Size 672 Byte
Status AC
Exec Time 27 ms
Memory 7532 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 3
AC × 41
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 02_handmade_36.txt, 02_handmade_37.txt, 02_handmade_38.txt, 02_handmade_39.txt, 02_handmade_40.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3504 KiB
00_sample_01.txt AC 1 ms 3508 KiB
00_sample_02.txt AC 1 ms 3624 KiB
01_random_03.txt AC 26 ms 7480 KiB
01_random_04.txt AC 26 ms 7384 KiB
01_random_05.txt AC 26 ms 7400 KiB
01_random_06.txt AC 25 ms 7356 KiB
01_random_07.txt AC 26 ms 7420 KiB
01_random_08.txt AC 3 ms 3828 KiB
01_random_09.txt AC 26 ms 7344 KiB
01_random_10.txt AC 15 ms 5700 KiB
01_random_11.txt AC 27 ms 7532 KiB
01_random_12.txt AC 26 ms 7416 KiB
01_random_13.txt AC 25 ms 7316 KiB
01_random_14.txt AC 26 ms 7416 KiB
01_random_15.txt AC 26 ms 7352 KiB
01_random_16.txt AC 25 ms 7280 KiB
01_random_17.txt AC 26 ms 7420 KiB
01_random_18.txt AC 26 ms 7396 KiB
01_random_19.txt AC 26 ms 7280 KiB
01_random_20.txt AC 26 ms 7340 KiB
01_random_21.txt AC 25 ms 7348 KiB
01_random_22.txt AC 26 ms 7420 KiB
01_random_23.txt AC 27 ms 7484 KiB
01_random_24.txt AC 27 ms 7420 KiB
01_random_25.txt AC 27 ms 7340 KiB
01_random_26.txt AC 26 ms 7424 KiB
01_random_27.txt AC 27 ms 7488 KiB
01_random_28.txt AC 25 ms 7320 KiB
01_random_29.txt AC 24 ms 7416 KiB
01_random_30.txt AC 25 ms 7416 KiB
01_random_31.txt AC 25 ms 7352 KiB
01_random_32.txt AC 25 ms 7324 KiB
01_random_33.txt AC 15 ms 5752 KiB
01_random_34.txt AC 21 ms 6476 KiB
01_random_35.txt AC 17 ms 5924 KiB
02_handmade_36.txt AC 1 ms 3404 KiB
02_handmade_37.txt AC 1 ms 3564 KiB
02_handmade_38.txt AC 21 ms 7416 KiB
02_handmade_39.txt AC 26 ms 7400 KiB
02_handmade_40.txt AC 15 ms 7488 KiB