Box Relations //2009 Asia Wuhan Regional Contest Hosted by Wuhan University 拓扑排序

本文深入探讨了游戏开发领域的关键技术,包括游戏引擎、编程语言、硬件优化等,并重点阐述了AI音视频处理的应用场景和实现方法,如语义识别、物体检测、语音变声等。

Box Relations

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 301    Accepted Submission(s): 94
Special Judge


Problem Description
There are  n boxes  C1, C2, ..., Cn in 3D space. The edges of the boxes are parallel to the  x, y or  z-axis. We provide some relations of the boxes, and your task is to construct a set of boxes satisfying all these relations.

There are four kinds of relations (1 <=  i,j <=  ni is different from  j):
  • I i j: The intersection volume of Ci and Cj is positive.

  • X i j: The intersection volume is zero, and any point inside Ci has smaller x-coordinate than any point inside Cj.

  • Y i j: The intersection volume is zero, and any point inside Ci has smaller y-coordinate than any point inside Cj.

  • Z i j: The intersection volume is zero, and any point inside Ci has smaller z-coordinate than any point inside Cj.
.
 

Input
There will be at most 30 test cases. Each case begins with a line containing two integers  n (1 <=  n <= 1,000) and  R (0 <=  R <= 100,000), the number of boxes and the number of relations. Each of the following  R lines describes a relation, written in the format above. The last test case is followed by  n= R=0, which should not be processed.
 

Output
For each test case, print the case number and either the word POSSIBLE or IMPOSSIBLE. If it's possible to construct the set of boxes, the  i-th line of the following n lines contains six integers  x1, y1, z1, x2, y2, z2, that means the  i-th box is the set of points ( x,y,z) satisfying  x1 <= x <= x2, y1 <= y <= y2, z1 <= z <= z2. The absolute values of  x1, y1, z1, x2, y2, z2 should not exceed 1,000,000.

Print a blank line after the output of each test case.
 

Sample Input
  
3 2 I 1 2 X 2 3 3 3 Z 1 2 Z 2 3 Z 3 1 1 0 0 0
 

Sample Output
  
Case 1: POSSIBLE 0 0 0 2 2 2 1 1 1 3 3 3 8 8 8 9 9 9 Case 2: IMPOSSIBLE Case 3: POSSIBLE 0 0 0 1 1 1
 

Source
 

Recommend
chenrui

 

 

 

#include<stdio.h>

#include<string.h>

int n,r,e;

struct NODE

{

    int v,next;

}p[900010];

int point[4][2010];

int q[4][2010],in[4][2010],ans[4][2010];

 

void addedge(int type,int u,int v)

{

    p[e].v=v;

    p[e].next=point[type][u];

    point[type][u]=e++;

    in[type][v]++;

}

 

void init()

{

    e=0;

    memset(in,0,sizeof(in));

    memset(point,-1,sizeof(point));

    for(int i=1;i<=n;i++)

      for(int j=1;j<=3;j++)

          addedge(j,i,i+n);

}

 

bool tuopu(int type)

{

    int front=0,top=0;

    for(int i=1;i<=2*n;i++)

    if(in[type][i]==0) q[type][top++]=i,in[type][i]--;

    while(front<top)

    {

        int u=q[type][front++];

        for(int i=point[type][u];i!=-1;i=p[i].next)

        {

            int v=p[i].v;

            in[type][v]--;

            if(in[type][v]==0)  q[type][top++]=v,in[type][v]--;

        }

    }

    return top==2*n;

}

void solve()

{

    for(int i=1;i<=3;i++)

    {

        if(!tuopu(i))

        {

            puts("IMPOSSIBLE");

            return ;

        }

    }

    puts("POSSIBLE");

    for(int j=1;j<=3;j++)

      for(int i=0;i<2*n;i++)

      ans[j][q[j][i]]=i;

     for(int i=1;i<=n;i++)

     printf("%d %d %d %d %d %d/n",ans[1][i],ans[2][i],ans[3][i],ans[1][i+n],ans[2][i+n],ans[3][i+n]);

}

 

int main()

{

    char str[10];

    int x,y,cas=1;

    while(scanf("%d%d",&n,&r)!=EOF)

    {

        if(n==0 && r==0) break;

        init();

        for(int i=1;i<=r;i++)

        {

            scanf("%s %d %d",str,&x,&y);

            if(str[0]=='I')

            {

                for(int j=1;j<=3;j++)

                {

                    addedge(j,x,y+n);

                    addedge(j,y,x+n);

                }

            }

            else if(str[0]=='X') addedge(1,x+n,y);

            else if(str[0]=='Y') addedge(2,x+n,y);

            else if(str[0]=='Z') addedge(3,x+n,y);

        }

        printf("Case %d: ",cas++);

        solve();

        puts("");

    }

    return 0;

}

分布式微服务企业级系统是一个基于Spring、SpringMVC、MyBatis和Dubbo等技术的分布式敏捷开发系统架构。该系统采用微服务架构和模块化设计,提供整套公共微服务模块,包括集中权限管理(支持单点登录)、内容管理、支付中心、用户管理(支持第三方登录)、微信平台、存储系统、配置中心、日志分析、任务和通知等功能。系统支持服务治理、监控和追踪,确保高可用性和可扩展性,适用于中小型企业的J2EE企业级开发解决方案。 该系统使用Java作为主要编程语言,结合Spring框架实现依赖注入和事务管理,SpringMVC处理Web请求,MyBatis进行数据持久化操作,Dubbo实现分布式服务调用。架构模式包括微服务架构、分布式系统架构和模块化架构,设计模式应用了单例模式、工厂模式和观察者模式,以提高代码复用性和系统稳定性。 应用场景广泛,可用于企业信息化管理、电子商务平台、社交应用开发等领域,帮助开发者快速构建高效、安全的分布式系统。本资源包含完整的源码和详细论文,适合计算机科学或软件工程专业的毕业设计参考,提供实践案例和技术文档,助力学生和开发者深入理解微服务架构和分布式系统实现。 【版权说明】源码来源于网络,遵循原项目开源协议。付费内容为本人原创论文,包含技术分析和实现思路。仅供学习交流使用。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值