QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#788266#5903. Xeno-archaeologyEibon12 69ms5476kbC++141.4kb2024-11-27 16:23:472024-11-27 16:23:53

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 16:23:53]
  • 评测
  • 测评结果:12
  • 用时:69ms
  • 内存:5476kb
  • [2024-11-27 16:23:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
const int N=405+5;
const int inf=0x3f3f3f3f3f3f3f3f;
const int mod=998244353;
typedef pair<int,int> pii;
int T=1,n,now;
int a[N],ax[N],ay[N];
vector<pii>sp;
pii opt;
bool check(int x,int y)
{
    for(int i=1;i<=n;i++){
		int xx=ax[i],yy=ay[i];
		xx-=x;
		yy-=y;
		int num=((max(abs(xx),abs(yy))&1)?1:0);
		if(num!=a[i]){
			return 0;
		}
	}
	return 1;
}
void solve()
{
	now++;sp.clear();
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		char c;
		cin>>ax[i]>>ay[i]>>c;
		if(c=='.'){
			a[i]=0;
		}
		else{
			a[i]=1;
		}
	}
	for(int i=-201;i<=201;i++){
		for(int j=-201;j<=201;j++){
			if(check(i,j)){
				sp.pb({i,j});
			}
		}
	}
	printf("Case #%lld: ",now);
	if(!sp.size()){
		puts("Too damaged");
		return;
	}
	int ans=1e18,xx=-1e18,yy=-1e18;
	for(auto tmp:sp){
		int x=tmp.fi;
		int y=tmp.se;
		ans=min(ans,abs(x)+abs(y));
	}
	for(auto tmp:sp){
		int x=tmp.fi;
		int y=tmp.se;
		if(ans==abs(x)+abs(y)){
			if(x>xx){
				opt={x,y};
				xx=x;yy=y;
			}
			else if(x==xx){
				if(y>yy){
					opt={x,y};
					yy=y;
				}
			}
		}
	}
	printf("%lld %lld\n",opt.fi,opt.se);
}
signed main()
{
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	scanf("%lld",&T);
	while(T--){
		solve();
	}
	return 0;
}
//dyyyyds

详细

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 69ms
memory: 5472kb

input:

50
1
0 0 .
1
0 0 #
3
0 0 #
0 1 #
1 0 #
5
50 30 #
49 30 #
49 31 #
49 32 #
50 32 #
2
-98 0 #
99 50 .
4
88 88 .
88 89 .
89 88 .
89 89 .
89
48 12 .
43 66 .
83 63 #
51 51 .
-85 65 #
4 -22 #
-75 -79 .
2 -17 #
-57 -66 .
-82 -51 .
-33 64 #
90 40 .
-29 50 .
-30 73 .
5 -58 .
8 -35 #
76 54 .
-91 35 .
-95 50 #
...

output:

Case #1: 0 0
Case #2: 1 0
Case #3: 1 1
Case #4: 50 31
Case #5: 1 0
Case #6: Too damaged
Case #7: Too damaged
Case #8: Too damaged
Case #9: -59 3
Case #10: 0 0
Case #11: -86 78
Case #12: -62 1
Case #13: -40 17
Case #14: Too damaged
Case #15: 1 0
Case #16: 0 -26
Case #17: 201 0
Case #18: -101 100
Case...

result:

ok 50 lines

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 30ms
memory: 5476kb

input:

50
736
-635197572891798 -244824021659868 #
362794489034032 -677184647696532 #
-320348303750089 -495621403120601 .
-946880625534191 -143990370594873 #
-724662984195181 -114177838293467 .
-34955462613239 -896259548370857 .
39793409400074 -634771697162784 #
-268086268222123 -741085061218071 .
368751280...

output:

Case #0: 1 0
Case #1: 1 0
Case #2: 1 0
Case #3: 1 0
Case #4: 1 0
Case #5: 1 0
Case #6: 1 0
Case #7: 1 0
Case #8: 1 0
Case #9: 1 0
Case #10: 1 0
Case #11: 1 0
Case #12: 1 0
Case #13: 1 0
Case #14: 1 0
Case #15: 1 0
Case #16: 1 0
Case #17: 1 0
Case #18: 1 0
Case #19: 1 0
Case #20: 1 0
Case #21: 1 0
Ca...

result:

wrong answer 1st lines differ - expected: 'Case #1: -402299503129410 237602221737985', found: 'Case #0: 1 0'