Submission #1156760
Source Code Expand
//
// main.cpp
// ac
//
// Created by 胡天翼 on 2017/2/21.
// Copyright © 2017年 胡天翼. All rights reserved.
//
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#define read freopen("in.txt","r",stdin)
#define maxlongint 2147483647
typedef long long LL;
typedef unsigned long long ULL;
#pragma comment(linker, "/STACK:102400000,102400000")
#define fori for(int i=1;i<=n;i++)
#define forj for(int j=1;j<=m;j++)
#define fork for(int k=1;k<=n;k++)
#define FOR(i,n) for(int i=1;i<=n;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define DREP(i,a,b) for(int i=a;i>=b;i--)
#define DOWN(i,n) for(int i=n;i>=1;i--)
#define enter cout<<endl;
#define in push_back
#define out pop_back
#define sqr(x) ((x)*(x))
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define offcin ios::sync_with_stdio(false)
#define s(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define sd(x,y) scanf("%d%d",&x,&y)
#define sch(s) scanf("%s",s)
#define fillfalse(v) memset(v,false,sizeof(v))
#define filltrue(v) memset(v,true,sizeof(v))
#define f0(a) memset(a,0,sizeof(a))
#define Fillplus(a) memset(a,-1,sizeof(a))
#define lowbit(x) x&(-x)
using namespace std;
const int maxn = 1e5+5;
const int N=1e6+5;
const int mod=1e9+7;
int i,x,y,z,n,m,k,t,l,r,mid,cc,ans,tmp,cnt;
string s;
int a[maxn];
int main()
{
cin>>n>>m>>k;
fori s(a[i]);
sort(a+1,a+n+1);
int y=0;
int sum=1;
int b=a[1];
fori
{
if(y>=m||a[i]-b>k) {sum++; b=a[i]; y=1;}
else y++;
}
cout<<sum<<endl;
}
Submission Info
Submission Time
2017-03-12 21:15:09+0900
Task
A - Airport Bus
User
huhuhu0930
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
1672 Byte
Status
AC
Exec Time
19 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:55:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fori s(a[i]);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
Set Name
Test Cases
Sample
sample1.txt, sample2.txt
All
sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt
Case Name
Status
Exec Time
Memory
in1.txt
AC
1 ms
256 KB
in2.txt
AC
19 ms
640 KB
in3.txt
AC
19 ms
640 KB
in4.txt
AC
19 ms
640 KB
in5.txt
AC
1 ms
256 KB
in6.txt
AC
19 ms
640 KB
in7.txt
AC
16 ms
640 KB
in8.txt
AC
19 ms
640 KB
sample1.txt
AC
1 ms
256 KB
sample2.txt
AC
1 ms
256 KB