QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#105659 | #6305. Chinese Checker | LYC_music# | WA | 1ms | 3456kb | C++14 | 2.2kb | 2023-05-14 17:35:12 | 2023-05-14 17:35:14 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define int ll
//#define N
using namespace std;
int vis[105][105],a[105][105];
int n;
int l[105],r[105];
int ans;
const int dx[6]={1,1,0,0,-1,-1};
const int dy[6]={0,-1,1,-1,0,1};
int chk(int x,int y)
{
return y>=l[x]&&y<=r[x];
}
void work(int sx,int sy)
{
for (int i=1;i<=17;i++)
for (int j=l[i];j<=r[i];j++)
vis[i][j]=0;
queue<pa>q;
q.push(mp(sx,sy));
vis[sx][sy]=1;
while (!q.empty())
{
int x=q.front().fi,y=q.front().se;
q.pop();
// cout<<sx<<" "<<sy<<" "<<x<<" "<<y<<" "<<vis[x][y]<<'\n';
for (int i=0;i<6;i++)
{
int nx=x,ny=y;
int s=0;
while (chk(nx,ny)&&a[nx][ny]==0)
{
nx+=dx[i],ny+=dy[i];
s++;
}
if (!chk(nx,ny)) continue;
// cout<<"!!!!"<<x<<" "<<y<<" "<<nx<<" "<<ny<<'\n';
int bl=1;
while (s--)
{
nx+=dx[i],ny+=dy[i];
if (!chk(nx,ny)||a[nx][ny]==1)
{
bl=0;
break;
}
}
if (!bl||vis[nx][ny]) continue;
vis[nx][ny]=1;
q.push(mp(nx,ny));
}
}
for (int i=1;i<=17;i++)
for (int j=l[i];j<=r[i];j++)
ans+=vis[i][j];
// cout<<"???"<<ans<<'\n';
ans--;
}
void BellaKira()
{
cin>>n;
for (int i=1;i<=n;i++)
{
int x,y;
cin>>x>>y;
a[x][y+l[x]-1]=1;
// assert(y<=r[i]-l[i]+1);
}
for (int i=1;i<=17;i++)
for (int j=l[i];j<=r[i];j++)
if (a[i][j])
{
a[i][j]=0;
work(i,j);
a[i][j]=1;
}
cout<<ans<<'\n';
for (int i=1;i<=18;i++)
for (int j=l[i];j<=r[i];j++)
a[i][j]=0;
ans=0;
}
signed main()
{
l[1]=13,r[1]=13;
for (int i=2;i<=4;i++)
l[i]=l[i-1]-1,r[i]=r[i-1];
r[5]=r[4]+4;
l[5]=l[4]-5;
for (int i=6;i<=9;i++)
l[i]=l[i-1],r[i]=r[i-1]-1;
for (int i=10;i<=13;i++)
l[i]=l[i-1]-1,r[i]=r[i-1];
for (int i=14;i<=17;i++)
l[i]=5,r[i]=5+17-i+1;
// for (int i=1;i<=17;i++)
// cout<<i<<" "<<l[i]<<" "<<r[i]<<endl;
IOS;
cin.tie(0);
int T=1;
cin>>T;
while (T--)
{
BellaKira();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3400kb
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: 1ms
memory: 3456kb
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:
207 403 216 533 406 233 163 52 335 103 1 143 111 65 25 148 410 309 18 232 91 195 299 24 109 257 321 473 179 92 265 286 33 7 119 191 441 295 63 177 281 64 18 165 89 187 38 167 346 133 207 292 0 114 116 54 30 13 63 169 176 34 467 170 221 12 59 0 258 114 106 427 8 362 88 126 83 392 67 29 490 373 6 201 ...
result:
wrong answer 1st numbers differ - expected: '190', found: '207'