Submission #58936487


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
int n,m,ans,l,kg;
int main(){
cin>>n>>m;
for(int i=1,x;i<=n;i++){
cin>>x;
if(!kg||x-l>=m)l=x,ans++,kg=1;
}
cout<<ans;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
int n,m,ans,l,kg;
int main(){
	cin>>n>>m;
	for(int i=1,x;i<=n;i++){
		cin>>x;
		if(!kg||x-l>=m)l=x,ans++,kg=1;
	}
	cout<<ans;
}

Submission Info

Submission Time
Task A - Candy Button
User zhanghe
Language C++ 20 (gcc 12.2)
Score 150
Code Size 182 Byte
Status AC
Exec Time 1 ms
Memory 3644 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 3
AC × 17
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_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3484 KB
00_sample_01.txt AC 1 ms 3448 KB
00_sample_02.txt AC 1 ms 3432 KB
01_random_00.txt AC 1 ms 3444 KB
01_random_01.txt AC 1 ms 3460 KB
01_random_02.txt AC 1 ms 3428 KB
01_random_03.txt AC 1 ms 3484 KB
01_random_04.txt AC 1 ms 3484 KB
01_random_05.txt AC 1 ms 3468 KB
01_random_06.txt AC 1 ms 3568 KB
01_random_07.txt AC 1 ms 3484 KB
02_handmade_00.txt AC 1 ms 3500 KB
02_handmade_01.txt AC 1 ms 3564 KB
02_handmade_02.txt AC 1 ms 3552 KB
02_handmade_03.txt AC 1 ms 3444 KB
02_handmade_04.txt AC 1 ms 3644 KB
02_handmade_05.txt AC 1 ms 3552 KB


2025-04-04 (Fri)
02:44:24 +00:00