QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#236181 | #7680. Subway | ucup-team1447# | WA | 11ms | 130832kb | C++23 | 2.5kb | 2023-11-03 17:48:58 | 2023-11-03 17:48:58 |
Judging History
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++,a[i].U[x].y+=D;
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++,a[i].D[x].y+=D;
// 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;
}
详细
Test #1:
score: 0
Wrong Answer
time: 11ms
memory: 130832kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 9 -105 -105999998 1 2 104 103000002 106 104000001 2 1 -101 -102999999 -99 -101999997 3 3 110 107000003 6 -102 -104999999 2 1 107 106000001 109 107000003 3 3 -98 -101999997
result:
wrong answer Polyline 2 intersects with previous polylines.