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
Task C - Fountain Walk
User Hany01
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2140 Byte
Status
Exec Time 56 ms
Memory 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
All 0 / 900 sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt, subtask_1_30.txt, subtask_1_31.txt, subtask_1_32.txt, subtask_1_33.txt, subtask_1_34.txt, subtask_1_35.txt, subtask_1_36.txt, subtask_1_37.txt, subtask_1_38.txt, subtask_1_39.txt, subtask_1_40.txt, subtask_1_41.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
subtask_1_01.txt 1 ms 256 KB
subtask_1_02.txt 1 ms 256 KB
subtask_1_03.txt 1 ms 256 KB
subtask_1_04.txt 1 ms 256 KB
subtask_1_05.txt 1 ms 256 KB
subtask_1_06.txt 1 ms 256 KB
subtask_1_07.txt 1 ms 256 KB
subtask_1_08.txt 1 ms 256 KB
subtask_1_09.txt 14 ms 256 KB
subtask_1_10.txt 29 ms 256 KB
subtask_1_11.txt 8 ms 256 KB
subtask_1_12.txt 53 ms 2560 KB
subtask_1_13.txt 32 ms 256 KB
subtask_1_14.txt 15 ms 256 KB
subtask_1_15.txt 8 ms 256 KB
subtask_1_16.txt 53 ms 2560 KB
subtask_1_17.txt 25 ms 256 KB
subtask_1_18.txt 21 ms 256 KB
subtask_1_19.txt 20 ms 256 KB
subtask_1_20.txt 51 ms 2560 KB
subtask_1_21.txt 53 ms 2560 KB
subtask_1_22.txt 56 ms 2048 KB
subtask_1_23.txt 56 ms 1792 KB
subtask_1_24.txt 1 ms 256 KB
subtask_1_25.txt 1 ms 256 KB
subtask_1_26.txt 1 ms 256 KB
subtask_1_27.txt 1 ms 256 KB
subtask_1_28.txt 36 ms 256 KB
subtask_1_29.txt 40 ms 256 KB
subtask_1_30.txt 55 ms 1792 KB
subtask_1_31.txt 38 ms 1792 KB
subtask_1_32.txt 38 ms 2560 KB
subtask_1_33.txt 39 ms 2176 KB
subtask_1_34.txt 39 ms 1792 KB
subtask_1_35.txt 43 ms 2560 KB
subtask_1_36.txt 45 ms 1792 KB
subtask_1_37.txt 43 ms 2560 KB
subtask_1_38.txt 43 ms 2560 KB
subtask_1_39.txt 43 ms 2560 KB
subtask_1_40.txt 45 ms 2176 KB
subtask_1_41.txt 43 ms 2176 KB