Contest Duration: ~ (local time) (150 minutes) Back to Home

Submission #1544984

Source Code Expand

Copy
```#include<bits/stdc++.h>
#define For(i , j , k) for (int i = (j) , _##end_ = (k) ; i <= _##end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , _##end_ = (k) ; i >= _##end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define pb push_back
#define Mod (1000000007)
#define Pi ((double)(acos(-1.000000000000000000000)))
typedef unsigned long long LL;
using namespace std;

const int maxn = 200010;

struct dcr
{
int x , y;
bool operator < (const dcr &Itm) const
{
return x < Itm.x;
}
}a[maxn];

int sx , sy , tx , ty , n , l , r , mid , stk[maxn] , top;

int main()
{
#ifdef hany01
freopen("test.in" , "r" , stdin);
freopen("test.out" , "w" , stdout);
#endif
scanf("%d%d%d%d" , &sx , &sy , &tx , &ty);
if (sx > tx)
swap(sx , tx) , swap(sy , ty);
scanf("%d" , &n);
if (sy < ty)
{
for (int i = 1 ; i <= n ; ++ i)
{
scanf("%d%d" , &a[i].x , &a[i].y);
if (a[i].x <= sx || a[i].x >= tx || a[i].y <= sy || a[i].y >= ty)
-- i , -- n;
}
sort(a + 1 , a + 1 + n);
if (n)
{
stk[1] = a[1].y;
top = 1;
For(i , 2 , n)
{
if (a[i].y > stk[top])
{
stk[++ top] = a[i].y;
continue;
}
l = 1;
r = top;
while (l < r)
{
mid = ((l + r) >> 1) + 1;
if (stk[mid] > a[i].y)
l = mid;
else
r = mid - 1;
}
stk[l] = a[i].y;
}
}
printf("%.15lf" , (ty - sy + tx - sx) * 100.0 - (20.0 - 5.0 * Pi) * top);
}
else
{
for (int i = 1 ; i <= n ; ++ i)
{
scanf("%d%d" , &a[i].x , &a[i].y);
if (a[i].x <= sx || a[i].x >= tx || a[i].y <= ty || a[i].y >= sy)
-- i , -- n;
}
sort(a + 1 , a + 1 + n);
if (n)
{
stk[n] = a[n].y;
top = 1;
Fordown(i , n - 1 , 1)
{
if (a[i].y > stk[top])
{
stk[++ top] = a[i].y;
continue;
}
l = 1;
r = top;
while (l < r)
{
mid = ((l + r) >> 1) + 1;
if (stk[mid] > a[i].y)
l = mid;
else
r = mid - 1;
}
stk[l] = a[i].y;
}
}
printf("%.15lf" , (sy - ty + tx - sx) * 100.0 - (20.0 - 5.0 * Pi) * top * 1.0);
}
return 0;
}```

#### Submission Info

Submission Time 2017-08-26 23:19:08+0900 C - Fountain Walk Hany01 C++14 (GCC 5.4.1) 0 2140 Byte WA 56 ms 2560 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:30:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d%d" , &sx , &sy , &tx , &ty);
^
./Main.cpp:33:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d" , &n);
^
./Main.cpp:38:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d" , &a[i].x , &a[i].y);
^
./Main.cpp:73:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d" , &a[i].x , &a[i].y);
^
```

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB