Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
24243 | liuyile | 【BJ】T3 | C++ | 运行超时 | 25 | 1000 MS | 288 KB | 1341 | 2023-12-20 12:10:51 |
#include<bits/stdc++.h> using namespace std; //#define int long long #define endl "\n" inline const int dis(int x,int y){ int s=x,b=y; return abs(s)+abs(b); } struct node{ int x,y; friend bool operator <(const node A,const node B){ if(dis(A.x,A.y)!=dis(B.x,B.y))return dis(A.x,A.y)<dis(B.x,B.y); if(A.x!=B.x)return A.x>B.x; return A.y>B.y; } }; inline node min(node A,node B){ if(A<B)return A; return B; } inline int dis_qbxf(node A,node B){ return max(abs(A.x-B.x),abs(A.y-B.y)); } struct NODE{ node loc; char x; inline bool chk(node A){ int d=dis_qbxf(A,loc); if(d&1) return x=='#'; else return x=='.'; } }T[1010]; int n; signed main (){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); //mak(); //freopen("square.in","r",stdin); //freopen("square.out","w",stdout); int t; cin>>t; for(int s=1;s<=t;s++){ cin>>n; for(int i=1;i<=n;i++) cin>>T[i].loc.x>>T[i].loc.y>>T[i].x; int Te=1e9; node P={Te,Te}; for(int i=-100;i<=100;i++) for(int j=-100;j<=100;j++){ bool p=1; node E={i,j}; for(int k=1;k<=n;k++) p&=T[k].chk(E); if(p)P=min(P,E); } cout<<"Case #"<<s<<": "; if(P.x==1e9)cout<<"Too damaged"<<endl; else cout<<P.x<<" "<<P.y<<endl; } cout.flush(); return 0; }