# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15737 |
2015-07-19T05:09:53 Z |
cki86201 |
정전 (OJUZ10_blackout) |
C++ |
|
0 ms |
0 KB |
#include<stdio.h>
#include<set>
#include<algorithm<
using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define X first
#define Y second
Pi q[300030];
int p[150020];
int cnt[2];
ll ans;
int main(){
int n, l;
scanf("%d%d",&n,&l);
for(int i=0;i<n;i++)scanf("%d",p+i);
sort(p, p+n);
for(int i=0;i<n;i++){
q[i+i] = Pi(p[i]-l, i);
q[i+i+1] = Pi(p[i]+l, n+i);
}
sort(q, q+n+n);
for(int i=0;i<n+n;i++){
if(i > 0 && cnt[0] > 0 && cnt[1] > 0)ans += (ll)q[i].X - q[i-1].X;
if(q[i].Y < n)cnt[q[i].Y&1]++;
else cnt[(q[i].Y-n)&1]--;
}
printf("%lld",ans);
return 0;
}
Compilation message
blackout.cpp:3:20: error: missing terminating > character
#include<algorithm<
^
blackout.cpp:3:20: fatal error: algorithm<: 그런 파일이나 디렉터리가 없습니다
compilation terminated.