Submission #420772

# Submission time Handle Problem Language Result Execution time Memory
420772 2021-06-08T13:50:29 Z Pyqe Izvanzemaljci (COI21_izvanzemaljci) C++14
5 / 100
1175 ms 1852 KB
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fr first
#define sc second

const long long ma=2e9,inf=1e18;
long long n,d;
pair<long long,long long> a[100069];
pair<pair<long long,long long>,long long> sq[3];

int main()
{
	long long i,im,x,y,w,mn,mx,lh,rh,md;
	bool bad;
	
	scanf("%lld%lld",&n,&d);
	for(i=1;i<=n;i++)
	{
		scanf("%lld%lld",&x,&y);
		a[i]={x,y};
	}
	for(lh=1,rh=ma;lh<=rh;)
	{
		md=(lh+rh)/2;
		bad=0;
		for(im=0;im<4;im++)
		{
			sort(a+1,a+n+1);
			if(d==1)
			{
				if(!im)
				{
					mn=inf;
					mx=-inf;
					for(i=1;i<=n;i++)
					{
						x=a[i].fr;
						y=a[i].sc;
						mn=min(mn,y);
						mx=max(mx,y);
						if(mx-mn>md||x-a[1].fr>md)
						{
							break;
						}
					}
					if(i>n)
					{
						bad=1;
						sq[0]={{a[1].fr,mn},md};
					}
				}
			}
			else if(d==2)
			{
				if(im<2)
				{
					
				}
			}
			else
			{
				if(im<2)
				{
					
				}
			}
			for(i=1;i<=n;i++)
			{
				x=a[i].fr;
				y=a[i].sc;
				a[i]={y,-x};
			}
			for(i=0;i<d;i++)
			{
				x=sq[i].fr.fr;
				y=sq[i].fr.sc;
				w=sq[i].sc;
				sq[i].fr={y,-x-w};
			}
		}
		if(bad)
		{
			rh=md-1;
		}
		else
		{
			lh=md+1;
		}
	}
	for(i=0;i<d;i++)
	{
		x=sq[i].fr.fr;
		y=sq[i].fr.sc;
		w=sq[i].sc;
		printf("%lld %lld %lld\n",x,y,w);
	}
}

Compilation message

izvanzemaljci.cpp: In function 'int main()':
izvanzemaljci.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%lld%lld",&n,&d);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
izvanzemaljci.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%lld%lld",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1123 ms 1832 KB Output is correct
8 Correct 1150 ms 1852 KB Output is correct
9 Correct 1175 ms 1836 KB Output is correct
10 Correct 1119 ms 1836 KB Output is correct
11 Correct 1148 ms 1836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Integer 0 violates the range [1, 2*10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 0 violates the range [1, 2*10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 308 KB Integer 0 violates the range [1, 2*10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 204 KB Integer 0 violates the range [1, 2*10^9]
2 Halted 0 ms 0 KB -