QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#193965#6305. Chinese Checkerucup-team870WA 0ms3576kbC++172.3kb2023-09-30 18:14:542023-09-30 18:14:54

Judging History

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

  • [2023-09-30 18:14:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3576kb
  • [2023-09-30 18:14:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define per(i,j,k) for(int i=j;i>=k;--i)
#define P pair<int,int>
#define ll long long
#define vi vector<int>
map<P,P>mp;
bool bd[50][50],hs[50][50],vis[50][50];
vector<P>all;
P q[200];
void slv(){
    int n;cin>>n;
    vector<P>p(n+1);
    for(auto [x,y]:all)hs[x][y]=0;
    rep(i,1,n)cin>>p[i].first>>p[i].second,p[i]=mp[p[i]],hs[p[i].first][p[i].second]=1;
    int ans=0;
    vector<P>nxt;
    auto wk=[&](int x,int y,const P&dir){
        for(int k=1;;++k){
            int nx=x+dir.first*k, ny=y+dir.second*k;
            if(!bd[nx][ny])return;
            if(!hs[nx][ny])continue;
            rep(t,1,2*k-1){
                if(t==k)continue;
                int xx=x+dir.first*t,yy=y+dir.second*t;
                if(!bd[xx][yy] || hs[xx][yy])return;
            }
            P ans={nx*2-x,ny*2-y};
            if(bd[ans.first][ans.second] && !hs[ans.first][ans.second] )nxt.push_back(ans);
            return;
        }
    };
    rep(i,1,n){
        auto [x,y]=p[i]; 
        // hs[x][y]=0;
        for(auto [u,v]:all)vis[u][v]=0;
        int L=1,R=0; q[++R]={x,y}; vis[x][y]=1;
        while(L<=R){
            auto [x,y]=q[L++];
            nxt.clear();
            wk(x,y,{0,1}); wk(x,y,{1,0}); wk(x,y,{1,1});
            wk(x,y,{0,-1}); wk(x,y,{-1,0}); wk(x,y,{-1,-1});
            for(auto [nx,ny]:nxt){
                if(!vis[nx][ny]){
                    vis[nx][ny]=1; q[++R]={nx,ny};
                }
            }
        }
        ans+=R-1;
        // hs[x][y]=1;
    }
    cout<<ans<<'\n';
}
signed main(){
    IOS
    vector<int>q[20];
    rep(i,1,4){
        rep(j,1,i)q[i].push_back(j);
    }
    rep(i,5,8){
        rep(j,-8+i,9)q[i].push_back(j);
    }
    rep(i,9,13){
        rep(j,1,i-9+9)q[i].push_back(j);
    }
    rep(i,14,17){
        rep(j,i-8,9)q[i].push_back(j);
    }
    rep(i,1,17){
        rep(j,0,(int)q[i].size()-1){
            q[i][j]+=4; mp[{i,j+1}]={i,q[i][j]}; bd[i][q[i][j]]=1; all.push_back({i,q[i][j]});
        }
    }
    int T;cin>>T;
    while(T--)slv();
}
/*
10
1 1
2 1
2 2
3 1
3 2
3 3
4 1
4 2
4 3
4 4

2
1 1
2 1
*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

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
14

result:

wrong answer 5th numbers differ - expected: '13', found: '14'