QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#236177#7680. Subwayucup-team1447#WA 12ms130524kbC++232.5kb2023-11-03 17:46:052023-11-03 17:46:07

Judging History

你现在查看的是最新测评结果

  • [2023-11-03 17:46:07]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:130524kb
  • [2023-11-03 17:46:05]
  • 提交

answer

#include <stdio.h>
#include <array>
#include <random>
#include <queue>
std::mt19937_64 rng(0x3d03d);
#include <math.h>
#include <time.h>
#include <assert.h>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <map>
using std::pair;
#include <vector>
#include <bitset>
#include <set>
#define ld(x) printf("%lld\n",x)
#define int long long
const int mod=1e9+7;
using std::vector;
using vi=vector<int>;
using pi=std::pair<int,int>;
using vpi=vector<pi>;
#define x first
#define y second
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
inline int read()
{
    int num=0,f=1;char c=getchar();
    while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
    while(c>47&&c<58)num=num*10+(c^48),c=getchar();
    return num*f;
}
typedef int arr[1000005];
const int D=1e6;
struct point{int x,y;};
struct pt{
	point a;
	int w;
	point u,d;// u d 是基准
	vector<point>U,D;
	bool operator<(const pt&b)const{
		return a.x==b.a.x?a.y<b.a.y:a.x<b.a.x;
	}
}a[1234567];
int sta[1234567];
signed main()
{
	int n=read();
	for(int i=1;i<=n;i++)a[i].a.x=read(),a[i].a.y=read(),a[i].w=read();
	std::sort(a+1,a+1+n);
	// 0 : down
	// 1 : up
	for(int i=1;i<=n;i++)
	{
		auto [x,y]=a[i].a;
		int dx=100+i*2,dy=D*dx;
		a[i].u={x+dx,y+dy};
		dx=-100-(n-i+1)*2,dy=D*dx;
		a[i].d={x+dx,y+dy};
		vi dn,up;
		for(int j=1;j<=a[i].w;j++)
		{
			if(sta[j])up.push_back(j-1);
			else dn.push_back(j-1);
			sta[j]^=1;
		}
		a[i].U=vector<point>(a[i].w,a[i].u),a[i].D=vector<point>(a[i].w,a[i].d);
		int tmp=0;
		for(int x:up)a[i].U[x].y+=x*D;
		tmp=0;
		for(int x:dn)a[i].U[x].y+=x*D,a[i].U[x].x++;
		
		tmp=0;
		for(int x:dn)a[i].D[x].y-=x*D;
		tmp=0;
		for(int x:up)a[i].D[x].y-=x*D,a[i].D[x].x++;
		
		// for(auto[x,y]:a[i].D)printf("[%d %d]",x,y);puts("");
	}
	int res=0;
	for(int i=1;i<=n;i++)res=max(res,a[i].w);
	ld(res);
	
	for(int i=0;i<res;i++)
	{
		int cur=0;
		vector<point>v;
		for(int j=1;j<=n;j++)
			if(a[j].w>i)
			{
				if(cur==0)v.push_back(a[j].D[i]),v.push_back(a[j].a),v.push_back(a[j].U[i]);
				else v.push_back(a[j].U[i]),v.push_back(a[j].a),v.push_back(a[j].D[i]);
				cur^=1;
			}
		printf("%d ",v.size());
		for(auto [x,y]:v)printf("%d %d ",x,y);
		puts("");
	}
	// for(int i=1,j;i<=n;i=j+1)
	// {
		// j=i;
		// while(j!=n&&a[j+1].x==a[j].x)j++;
		// for(int x=i;x<=j;x++)
		// {
// 			
		// }
	// }
	fprintf(stderr,"%.12lf\n",1.*clock()/CLOCKS_PER_SEC);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 12ms
memory: 130524kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
9 -105 -105999998 1 2 104 102000002 106 104000001 2 1 -101 -103999999 -99 -101999997 3 3 110 106000003 
6 -102 -104999999 2 1 107 105000001 109 107000003 3 3 -98 -102999997 

result:

wrong answer Polyline 2 intersects with previous polylines.