Submission #14167

# Submission time Handle Problem Language Result Execution time Memory
14167 2015-05-02T20:19:31 Z pichulia 정전 (OJUZ10_blackout) C++
100 / 100
51 ms 8896 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
long long int n, m;
long long int a[1000000];
long long int res;
int main()
{
	int i, j, k, l;
	scanf("%lld %lld",&n,&m);
	for(i=0;i<n;i++){scanf("%lld",&a[i]);a[i]-=m;}
	sort(a,a+n);
	m=2*m;
	long long int si=a[0];
	long long int ei=a[0]+m;
	for(i=1;i<n;i++)
	{
//		printf("%d %d %d\n",si,ei,a[i]);
		if(si<a[i])si=a[i];
		if(ei>si){res += ei-si; si=ei;}
		ei=a[i]+m;
	}
	printf("%lld\n",res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 0 ms 8896 KB Output is correct
4 Correct 0 ms 8896 KB Output is correct
5 Correct 0 ms 8896 KB Output is correct
6 Correct 0 ms 8896 KB Output is correct
7 Correct 0 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 0 ms 8896 KB Output is correct
4 Correct 0 ms 8896 KB Output is correct
5 Correct 0 ms 8896 KB Output is correct
6 Correct 0 ms 8896 KB Output is correct
7 Correct 0 ms 8896 KB Output is correct
8 Correct 0 ms 8896 KB Output is correct
9 Correct 0 ms 8896 KB Output is correct
10 Correct 0 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 40 ms 8896 KB Output is correct
4 Correct 41 ms 8896 KB Output is correct
5 Correct 40 ms 8896 KB Output is correct
6 Correct 33 ms 8896 KB Output is correct
7 Correct 14 ms 8896 KB Output is correct
8 Correct 23 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 8896 KB Output is correct
2 Correct 2 ms 8896 KB Output is correct
3 Correct 33 ms 8896 KB Output is correct
4 Correct 16 ms 8896 KB Output is correct
5 Correct 41 ms 8896 KB Output is correct
6 Correct 51 ms 8896 KB Output is correct
7 Correct 33 ms 8896 KB Output is correct
8 Correct 26 ms 8896 KB Output is correct
9 Correct 50 ms 8896 KB Output is correct
10 Correct 51 ms 8896 KB Output is correct
11 Correct 21 ms 8896 KB Output is correct
12 Correct 34 ms 8896 KB Output is correct
13 Correct 49 ms 8896 KB Output is correct
14 Correct 32 ms 8896 KB Output is correct
15 Correct 25 ms 8896 KB Output is correct