답안 #104129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104129 2019-04-04T07:36:22 Z Fasho Automobil (COCI17_automobil) C++14
0 / 100
1000 ms 8312 KB
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
#define mod 1000000007
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum,k,tut[N],mark[N];


int main()
{
	fast;
	cin>>n>>m>>k;
	fs(ar,m);
	sort(ar+1,ar+1+m);

	for(int i=1;i<=m;i++)
		for(int j=max(ar[i]-k,1ll);j<=ar[i]+k && j<=n;j++)
			mark[j]=1;
	ll last=INT_MIN;
	// fo(i,1,n)
	// 	cout<<mark[i]<<sp;
	// 	cout<<endl;
	for(int i=1;i<=n;i++)
	{
		if(i-last>k*2 && !mark[i])
			last=i,sum++;
	}
	cout<<sum;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 512 KB Output isn't correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 3 ms 384 KB Output isn't correct
6 Incorrect 3 ms 384 KB Output isn't correct
7 Incorrect 3 ms 384 KB Output isn't correct
8 Incorrect 3 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 3 ms 384 KB Output isn't correct
11 Incorrect 72 ms 1536 KB Output isn't correct
12 Incorrect 340 ms 3432 KB Output isn't correct
13 Incorrect 25 ms 768 KB Output isn't correct
14 Incorrect 52 ms 3456 KB Output isn't correct
15 Incorrect 406 ms 4472 KB Output isn't correct
16 Incorrect 845 ms 8284 KB Output isn't correct
17 Incorrect 826 ms 8284 KB Output isn't correct
18 Incorrect 860 ms 8284 KB Output isn't correct
19 Incorrect 929 ms 8312 KB Output isn't correct
20 Execution timed out 1059 ms 8312 KB Time limit exceeded