QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#246903#7680. Subwayucup-team052#WA 1ms3604kbC++142.2kb2023-11-11 11:42:012023-11-11 11:42:01

Judging History

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

  • [2023-11-11 11:42:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3604kb
  • [2023-11-11 11:42:01]
  • 提交

answer

#include<bits/stdc++.h>
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#define DD(...) D(#__VA_ARGS__ "="),debug_helper::debug(__VA_ARGS__),D("\n")
#include"/home/xay5421/debug.hpp"
#else
#define D(...) ((void)0)
#define DD(...) ((void)0)
#endif
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define each(x,v) for(auto&x:v)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
template<class T>void rd(T&x){int f=0,c;while(!isdigit(c=getchar()))f^=!(c^45);x=(c&15);while(isdigit(c=getchar()))x=x*10+(c&15);if(f)x=-x;}
template<class T>void pt(T x,int c=-1){if(x<0)putchar('-'),x=-x;if(x>9)pt(x/10);putchar(x%10+48);if(c!=-1)putchar(c);}
using namespace std;
using LL=long long;
using ULL=unsigned long long;
const int N=55;
// mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng(0);
int brand(){return rng()&0X7FFFFFFF;}
int n,cur[N];
struct vec{
	int x,y,tt;
	vec operator-(const vec&rhs)const{return (vec){x-rhs.x,y-rhs.y,0};}
	vec operator+(const vec&rhs)const{return (vec){x+rhs.x,y+rhs.y,0};}
	vec operator*(const int&k)const{return (vec){x*k,y*k,0};}
}a[N],w[N];
LL cross(vec a,vec b){return 1LL*a.x*b.y-1LL*a.y*b.x;}
vec Get(vec a,vec b){
	return a+b;
}
int main(){
#ifdef xay5421
	freopen("a.in","r",stdin);
#endif
	rd(n);
	int ans=0;
	rep(i,1,n){
		rd(a[i].x),rd(a[i].y),rd(a[i].tt);
		ans=max(ans,a[i].tt);
	}
	if(n==1){
		a[++n]=a[1];
		++a[2].x;
	}
	vec bg;
	auto test=[&](){
		rep(i,1,n){
			rep(j,i+1,n){
				if(cross(a[i]-bg,a[j]-bg)==0){
					return 0;
				}
			}
		}
		return 1;
	};
	while(1){
		bg=(vec){-1001-brand()%1000,-1001-brand()%1000};
		if(test())break;
	}
	sort(a+1,a+n+1,[&](vec a,vec b){return cross(a-bg,b-bg)>0;});
	rep(i,1,n-1){
		w[i]=Get(a[i]-bg,a[i+1]-bg);
	}
	rep(i,1,n){
		cur[i]=0;
	}
	printf("%d\n",ans);
	rep(_,1,ans){
		vector<vec>v;
		rep(i,1,n){
			if(a[i].tt){
				--a[i].tt;
				v.pb(a[i]);
			}else{
				++cur[i];
				v.pb(a[i]+(a[i]-bg)*cur[i]);
			}
			if(i<n){
				v.pb(bg+w[i]*_);
			}
		}
		printf("%d ",SZ(v));
		for(auto&[x,y,z]:v)printf("%d %d ",x,y);
		puts("");
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3564kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
5 2 1 1402 1596 3 3 1401 1597 1 2 
5 2 1 4201 4784 3 3 4199 4786 1399 1596 

result:

ok ok Sum L = 10

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1
1 1 1

output:

1
3 2 1 1400 1594 1 1 

result:

ok ok Sum L = 3

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3604kb

input:

1
1 1 50

output:

50
3 2 1 1400 1594 1 1 
3 2 1 4197 4780 1 1 
3 2 1 6994 7966 1 1 
3 2 1 9791 11152 1 1 
3 2 1 12588 14338 1 1 
3 2 1 15385 17524 1 1 
3 2 1 18182 20710 1 1 
3 2 1 20979 23896 1 1 
3 2 1 23776 27082 1 1 
3 2 1 26573 30268 1 1 
3 2 1 29370 33454 1 1 
3 2 1 32167 36640 1 1 
3 2 1 34964 39826 1 1 
3 2 1...

result:

wrong answer Polyline 2 intersects with previous polylines.