QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#788243#5812. MarblesEibon0 82ms5476kbC++141.4kb2024-11-27 16:19:592024-11-27 16:19:59

Judging History

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

  • [2024-11-27 16:19:59]
  • 评测
  • 测评结果:0
  • 用时:82ms
  • 内存:5476kb
  • [2024-11-27 16:19:59]
  • 提交

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=-200;i<=200;i++){
		for(int j=-200;j<=200;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: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 82ms
memory: 5208kb

input:

50
14
l c c i l i g g e e h o h f o f d d m m b b n n k k j j
20
n r q b i b i r n q k u o j c p m l m l d e d e h t h t p j c u o g k g s f s f
12
j k b l g d i h f e m c g l b k j c m e f h i d
18
s n o m m j o n d s f d f p p j e q i g q c g i e c h r l h b k l k r b
12
i e i e j m b h b j h m k ...

output:

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
Case #22: 1 0
C...

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

50
500
fl sr ec fl fn ec eq fn qb eq cf qb rk cf tf rk tk tf j tk qc j af qc vc af ul vc br ul rr br pd rr zm pd nq zm re nq gi re hr gi sh hr ip sh nl ip pg nl ih pg yj ih ss yj ck ss or ck qp or ol qp nh ol jb nh is jb gg is di gg pp di sn pp mn sn zn mn vp zn wp vp bi wp pm bi zr pm ao zr kf ao i...

output:

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
Case #22: 1 0
C...

result:

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