QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#236156 | #7680. Subway | ucup-team1447# | WA | 12ms | 128544kb | C++23 | 2.5kb | 2023-11-03 17:16:20 | 2023-11-03 17:16:21 |
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=1e1;
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=10+i*2,dy=D*dx;
a[i].u={x+dx,y+dy};
dx=-10-(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+=tmp++;
tmp=0;
for(int x:dn)a[i].U[x].y+=tmp++,a[i].U[x].x++;
tmp=0;
for(int x:dn)a[i].D[x].y-=tmp++;
tmp=0;
for(int x:up)a[i].D[x].y-=tmp++,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: 128544kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 9 -15 -158 1 2 14 122 16 141 2 1 -11 -139 -9 -117 3 3 20 163 6 -12 -139 2 1 17 141 19 163 3 3 -8 -117
result:
wrong answer Self-intersecting polyline 1.