Submission #14166

# Submission time Handle Problem Language Result Execution time Memory
14166 2015-05-02T20:17:50 Z pichulia 정전 (OJUZ10_blackout) C++
50 / 100
52 ms 4988 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef pair<int, int> pii;
int n, m;
int a[1000000];
int res;
int main()
{
	int i, j, k, l;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){scanf("%d",&a[i]);a[i]-=m;}
	sort(a,a+n);
	m=2*m;
	int si=a[0];
	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("%d\n",res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4988 KB Output is correct
2 Correct 0 ms 4988 KB Output is correct
3 Incorrect 0 ms 4988 KB Output isn't correct
4 Correct 0 ms 4988 KB Output is correct
5 Correct 0 ms 4988 KB Output is correct
6 Correct 0 ms 4988 KB Output is correct
7 Correct 0 ms 4988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4988 KB Output is correct
2 Correct 0 ms 4988 KB Output is correct
3 Correct 0 ms 4988 KB Output is correct
4 Correct 0 ms 4988 KB Output is correct
5 Correct 0 ms 4988 KB Output is correct
6 Correct 0 ms 4988 KB Output is correct
7 Correct 0 ms 4988 KB Output is correct
8 Correct 0 ms 4988 KB Output is correct
9 Correct 0 ms 4988 KB Output is correct
10 Correct 0 ms 4988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 4988 KB Output is correct
2 Correct 0 ms 4988 KB Output is correct
3 Correct 10 ms 4988 KB Output is correct
4 Correct 44 ms 4988 KB Output is correct
5 Correct 43 ms 4988 KB Output is correct
6 Correct 52 ms 4988 KB Output is correct
7 Correct 27 ms 4988 KB Output is correct
8 Correct 21 ms 4988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 4988 KB Output is correct
2 Correct 24 ms 4988 KB Output is correct
3 Correct 43 ms 4988 KB Output is correct
4 Correct 45 ms 4988 KB Output is correct
5 Correct 23 ms 4988 KB Output is correct
6 Correct 45 ms 4988 KB Output is correct
7 Correct 17 ms 4988 KB Output is correct
8 Correct 43 ms 4988 KB Output is correct
9 Correct 25 ms 4988 KB Output is correct
10 Incorrect 51 ms 4988 KB Output isn't correct
11 Correct 0 ms 4988 KB Output is correct
12 Correct 20 ms 4988 KB Output is correct
13 Correct 28 ms 4988 KB Output is correct
14 Correct 46 ms 4988 KB Output is correct
15 Correct 45 ms 4988 KB Output is correct