QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297963 | #6305. Chinese Checker | PlentyOfPenalty# | WA | 8ms | 3512kb | C++20 | 2.1kb | 2024-01-05 14:51:46 | 2024-01-05 14:51:46 |
Judging History
answer
#include<bits/stdc++.h>
#define x first
#define y second
#define all(x) begin(x),end(x)
using namespace std;
using pii=pair<int,int>;
const int M=40;
const int mov[6][2]={
{0,2},{0,-2},
{1,1},{1,-1},
{-1,1},{-1,-1},
};
int T,n;
int __a[M<<1][M<<1],*_a[M<<1],**a;
int __b[M<<1][M<<1],*_b[M<<1],**b;
int __c[M<<1][M<<1],*_c[M<<1],**c;
int main(){
#ifndef ONLINE_JUDGE
freopen("H.in","r",stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
for(int i=0;i<(M<<1);i++){
_a[i]=__a[i]+M;
_b[i]=__b[i]+M;
_c[i]=__c[i]+M;
}
a=_a+M;
b=_b+M;
c=_c+M;
cin>>T;
for(int i=0;i<=4;i++)
for(int j=-8-i;j<=i+8;j+=2){
c[i][j]=1;
c[-i][j]=1;
}
for(int i=5;i<=8;i++)
for(int j=i-8;j<=8-i;j+=2){
c[i][j]=1;
c[-i][j]=1;
}
while(T--){
cin>>n;
vector<pii> nod;
for(int x,y,i=1;i<=n;i++){
cin>>x>>y;
x-=9;
for(int i=-12;i<=12;i++)
if(c[x][i]&&!--y){
y=i;
break;
}
nod.emplace_back(x,y);
}
// for(auto [x,y]:nod)cerr<<"! "<<x<<' '<<y<<endl;
int ans=0;
for(int i=0;i<nod.size();i++){
memset(__a,0,sizeof(__a));
memset(__b,0,sizeof(__b));
for(int j=0;j<nod.size();j++)
if(i!=j){
a[nod[j].x][nod[j].y]=1;
}
queue<pii> q;
b[nod[i].x][nod[i].y]=1;
q.push(make_pair(nod[i].x,nod[i].y));
// fprintf(stderr,"i=%d x=%d y=%d\n",i,nod[i].x,nod[i].y);
while(q.size()){
pii u=q.front(),v;
q.pop();
for(int i=0;i<6;i++){
for(int k=1;;k++){
v.x=u.x+2*k*mov[i][0];
v.y=u.y+2*k*mov[i][1];
if(!c[v.x][v.y])break;
if(a[u.x+k*mov[i][0]][u.y+k*mov[i][1]]){
if(!a[v.x][v.y]){
if(!b[v.x][v.y]){
// printf("(%d,%d) -> (%d,%d)\n",u.x,u.y,v.x,v.y);
++ans;
b[v.x][v.y]=1;
q.push(v);
}
}
break;
}
}
}
}
}
cout<<ans<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3504kb
input:
5 1 1 1 2 1 1 2 1 2 9 4 9 6 10 1 1 2 1 2 2 3 1 3 2 3 3 4 1 4 2 4 3 4 4 10 1 1 2 1 2 2 5 7 3 2 3 3 4 1 4 2 4 3 4 4
output:
0 1 2 6 13
result:
ok 5 number(s): "0 1 2 6 13"
Test #2:
score: -100
Wrong Answer
time: 8ms
memory: 3512kb
input:
100 81 1 1 16 1 11 4 13 8 12 3 12 12 11 1 4 2 9 5 8 10 5 5 9 7 3 2 14 1 7 11 13 7 10 2 8 3 9 8 10 6 12 10 6 7 11 2 7 3 13 12 8 6 17 1 10 5 5 12 13 9 13 1 9 4 5 10 11 8 13 4 5 4 9 1 7 8 5 6 13 13 5 1 9 3 8 8 8 5 13 2 13 5 11 3 9 2 6 4 3 3 8 2 13 11 8 7 5 7 6 10 11 9 10 3 11 10 6 3 7 1 4 4 15 2 7 2 3 ...
output:
361 643 344 720 620 408 209 45 508 93 1 371 117 131 25 202 606 482 10 273 187 243 647 16 112 465 494 674 313 93 308 471 25 10 153 306 609 399 53 322 576 50 10 333 80 292 33 245 576 137 312 492 0 120 130 90 22 5 99 229 218 26 622 232 323 4 68 0 415 144 148 517 0 564 100 112 92 457 90 34 778 645 7 372...
result:
wrong answer 1st numbers differ - expected: '190', found: '361'