先不改題,此次主要不在T3上。數組
此次有必要粘文件得分了。ide
臨考前總解鎖新鍋我也不知道這是什麼個事啊。。。函數
T1宏定義寫掛。由於原來在OJ上沒事因此一直沒注意。在Lemon評測下直接所有RE。spa
GG在主函數裏出現了。乍一眼看上去好像沒什麼問題。3d
可是在最終評測下若是主函數返回值非0的話是不看你的結果的。code
不知道爲何OJ上能過。。。blog
而後T2也飛天了,這個更玄學一些。it
其它地方沒改。理論上1e14足夠了可是最後不知道爲何仍是炸了。(由於每一個點最多會被通過1次,因此應該是1e9×點數1e5)io
inf沒開夠致使上天也是頭一回見。。。event
不要僞證,能保險一些就保險一些,數組開夠,inf設的足夠大!!!
一場考試的得分由於這些鍋總分恰好只剩下一半,應該能漲記性了。
RP完全用盡以後就是這個狼狽模樣。。。。
聯賽就在眼前了,要是一天直接只有115的話那確定退役了。。。
這究竟是怎麼了啊。。。
T1:五子棋
一個簡單到連部分分都沒辦法給的題。
除了skyh不會下五子棋和我返回值非0之外大多數人都A了。。。
1 #include<cstdio> 2 #define GG if(cnt>=5)return printf("%c %d\n",opt==1?'A':'B',i);//,0;注意返回值。。 3 int a[17][17],n; 4 int main(){ 5 freopen("five.in","r",stdin); 6 freopen("five.out","w",stdout); 7 scanf("%d",&n); 8 int opt=1; 9 for(int i=1,x,y;i<=n;++i){ 10 scanf("%d%d",&x,&y); 11 a[x][y]=opt; 12 int rx=x,ry=y,cnt=1; 13 while(a[x+1][y]==opt)cnt++,x++; 14 x=rx; 15 while(a[x-1][y]==opt)cnt++,x--; 16 x=rx;GG;cnt=1; 17 while(a[x][y+1]==opt)cnt++,y++; 18 y=ry; 19 while(a[x][y-1]==opt)cnt++,y--; 20 y=ry;GG;cnt=1; 21 while(a[x-1][y-1]==opt)cnt++,x--,y--; 22 x=rx;y=ry; 23 while(a[x+1][y+1]==opt)cnt++,x++,y++; 24 x=rx;y=ry;GG;cnt=1; 25 while(a[x+1][y-1]==opt)cnt++,x++,y--; 26 x=rx;y=ry; 27 while(a[x-1][y+1]==opt)cnt++,x--,y++; 28 GG;opt*=-1; 29 }puts("Tie"); 30 }
T2:迷宮
每一個點第d+1次被擴展到的時候再入隊,最短路。
1 #include<cstdio> 2 #include<queue> 3 using namespace std; 4 #define inf 1234567890123456 5 int n,m,k,d,cnt=1,fir[100005],l[2000005],to[2000005],deg[100005],w[2000005]; 6 priority_queue<long long>q[100005]; 7 priority_queue<pair<long long,int> ,vector<pair<long long,int> >,greater<pair<long long,int> > >Q; 8 void link(int a,int b,int v){l[++cnt]=fir[a];fir[a]=cnt;to[cnt]=b;w[cnt]=v;deg[a]++;} 9 int main(){ 10 freopen("maze.in","r",stdin); 11 freopen("maze.out","w",stdout); 12 scanf("%d%d%d%d",&n,&m,&k,&d);d++; 13 for(int i=1,a,b,v;i<=m;++i)scanf("%d%d%d",&a,&b,&v),a++,b++,link(a,b,v),link(b,a,v); 14 for(int i=1;i<=n;++i)for(int j=1;j<=d;++j)q[i].push(inf); 15 for(int i=1,E;i<=k;++i){ 16 scanf("%d",&E);E++;Q.push(make_pair(0,E)); 17 while(!q[E].empty())q[E].pop(); 18 for(int i=1;i<=d;++i)q[E].push(0); 19 } 20 while(!Q.empty()){ 21 int p=Q.top().second;long long D=Q.top().first;Q.pop(); 22 if(D!=q[p].top())continue;//printf("%d\n",p); 23 for(int i=fir[p];i;i=l[i]){ 24 int rd=q[to[i]].top();q[to[i]].push(D+w[i]);q[to[i]].pop(); 25 if(q[to[i]].top()<rd)Q.push(make_pair(q[to[i]].top(),to[i])); 26 } 27 } 28 printf("%lld\n",q[1].top()==inf?-1:q[1].top()); 29 }
T3:三華聚頂
不會。這不是重點。先讓前兩道題不掛分再說。