悲剧的TC,悲剧的1000__第一次TC小结

来源:互联网 发布:本地端口怎么开启 编辑:程序博客网 时间:2024/05/16 10:48

哥又悲剧了,欢迎大家来围观。。。

TC里1000分的题悲剧的函数没写成public,本地编译的好好的在TC里死活编译不过,郁闷纠结,结束后在练习房一测82个数据轻松秒过,速度还奇快,狂吐血,我的命运怎么这么悲惨啊,我不服啊,不就个public嘛,至于这么贵吗,1000分啊,抓狂了。。。

第一次去做TC,没想到题目这么水,250直接秒杀,看500的没想法,直接做1000的,一看迷宫问题,虽然要搞一下概率,但总体思路还是蛮清楚的,然后犀利的宽搜加位运算压缩状态加hash函数判重,然后啪啪敲了半个小时代码,再然后本地编译过了,再再然后TC里编译过不了,再再的没然后了,时间到了,囧...

接下去进入Challenge环节,一看我靠那仅有的250分的题以速度优势排在第三,狂开心,然后突然我们那个房间唯一的一个500分的被cha掉了,我光荣的上升到第二,哈哈,奸笑中..要是第二也被cha掉那我岂不是能第一了(无限yy中..)然而直到SystemTest结束我盼望的事情还是没有发生,只能屈居第二了,要是我那1000分的没挂掉,哼哼,还不虐死你们。

最后一看哇rating1200多分了,比老祝都多了,名字都变绿色了,据他说变绿了就能去div 1了,哈哈哥1000的挂掉了还是这么犀利啊!!!

最后贴下1000的代码让大家瞻仰一下:

//SRM464 1000

 

#include<iostream>

#include<vector>

#include<string>

#include<queue>

using namespace std;

struct status

{

int x,y,z;

};

queue<status> q;

int map[100][100];

int hash[52][52][1025];

class ColorfulMazeTwo

{

public:

double getProbability(vector <string> maze, vector <int> trap)

{

  double ans,temp;

  int i,j,lx,ly;

  status s,e,now,next;

  memset(hash,0,sizeof(hash));

  memset(map,0,sizeof(map));

  lx=maze.size();

  ly=maze[0].length();

  for(i=0;i<maze.size();i++)

   for(j=0;j<maze[i].length();j++)

   {

   if (maze[i][j]=='#') map[i][j]=-1;

   else

   if (maze[i][j]=='$') {s.x=i;s.y=j;}

   else

   if (maze[i][j]=='!') {e.x=i;e.y=j;}

   else

   if (maze[i][j]=='.') {}

   else

   {

    map[i][j]=maze[i][j]-'A'+1;

   }

   }

   s.z=0;

   while(!q.empty()) q.pop();

   q.push(s);

   ans=0;

   while(!q.empty())

   {

    now=q.front();

    q.pop();

    if (hash[now.x][now.y][now.z]) continue;

    hash[now.x][now.y][now.z]=true;

    if ((now.x==e.x)&&(now.y==e.y))

    {

      temp=1;

      for(i=1;i<=7;i++)

      if (now.z&(1<<i)) 

       temp=temp*(100-trap[i-1])/100;

       if (temp>ans) ans=temp;

    }

    for(i=-1;i<=1;i++)

     for(j=-1;j<=1;j++)

      if (i*j==0)

     {

      next.x=now.x+i;

      next.y=now.y+j;

      if ((next.x>=0)&&(next.x<lx)&&(next.y>=0)&&(next.y<ly)&&(map[next.x][next.y]!=-1))

      {

         next.z=now.z|(1<<map[next.x][next.y]);

         q.push(next);

      }

     }

  }

   return ans;

}

};

原创粉丝点击