| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 20242 | jjwdi0 | 정전 (OJUZ10_blackout) | C++98 | 44 ms | 24 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <algorithm>
#define INF -1234567891
typedef long long ll;
using namespace std;
int a[150005], l;
int n, i, left=INF, right=INF, t1, t2;
ll ans;
int f(int x)
{
return x>0?x:0;
}
main()
{
scanf("%d%d", &n, &l);
for(i=0; i<n; i++)scanf("%d", a+i);
sort(a, a+n);
for(i=1; i<n; i++)
{
if(a[i]-a[i-1]>=2*l)continue;
t1=a[i]-l;t2=a[i-1]+l;
// printf("%d %d\n", t2-t1, f(right-t1));
ans+=(ll)(t2-t1)-(ll)f(right-t1);
left=t1;right=t2;
// printf("%lld\n", ans);
}
printf("%lld", ans);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
