QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96782#6305. Chinese CheckerComplexPugWA 12ms3424kbC++202.8kb2023-04-15 16:17:162023-04-15 16:17:18

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-15 16:17:18]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:3424kb
  • [2023-04-15 16:17:16]
  • 提交

answer

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define int long long
using namespace std;
const int _=2e6+7;
int read() {int x;scanf("%lld",&x);return x;}
int n;
int fx[]={0,0,1,-1,1,-1};
int fy[]={1,-1,0,0,1,-1};
void solve() {
    int n=read();
    
    vector<int> l(20,0),siz(20,0);
    vector vis(20,vector<int>(20,0));
    FOR(i,1,17) {
        l[i]=0x3f3f3f3f;
        if(i<=13) l[i]=min(l[i],5ll);
        if(i>=5) l[i]=min(l[i],i-4ll);
    }
    FOR(i,1,4) siz[i]=siz[17-i+1]=i;
    FOR(i,5,9) siz[i]=siz[17-i+1]=18-i;
    FOR(i,1,17) {
        FOR(j,l[i],l[i]+siz[i]-1) {
            vis[i][j]=1;
        }
    }
    vector g(20,vector<int>(20,0));
    FOR(i,1,n) {
        int x=read(),y=read();
        g[x][l[x]+y-1]=1;
    }
    auto judge=[&](array<int,2> a,array<int,2> b) -> bool {
        if(g[b[0]][b[1]]==0) return 0;
        array<int,2> c={b[0]+b[0]-a[0],b[1]+b[1]-a[1]};
        if(1<=c[0]&&c[0]<=17&&1<=c[1]&&c[1]<=17);else return 0;
        // cout<<"!\n";
        if(vis[c[0]][c[1]]==1&&g[c[0]][c[1]]==0) {
            int x=a[0],y=a[1];
            int ad_x=b[0]-a[0];
            int ad_y=b[1]-a[1];
            if(ad_x!=0) ad_x/=abs(ad_x);
            if(ad_y!=0) ad_y/=abs(ad_y);
            while(233) {
                x+=ad_x,y+=ad_y;
                if(x==c[0]&&y==c[1]) break;
                if(x!=b[0]&&y!=b[1]) if(g[x][y]) return 0;
            }
            return 1;
        }
        return 0;
    };
    int ans=0;
    // FOR(i,1,17) {
    //     FOR(j,1,17) {
    //         cout<<g[i][j];
    //     } cout<<"\n";
    // }
    FOR(i,1,17) FOR(j,1,17) if(g[i][j]) {
        // if(i==3&&j==5);else continue;
        vector f(20,vector<int>(20,0));
        g[i][j]=0;f[i][j]=1;
        queue<array<int,2>> q;
        q.push({i,j});
        while(!q.empty()) {
            auto [x,y]=q.front();q.pop();
            for(int kkk=0;kkk<6;++kkk) {
                int nx=x+fx[kkk],ny=y+fy[kkk];
                while(vis[nx][ny]&&g[nx][ny]==0) nx+=fx[kkk],ny+=fy[kkk];
                if(vis[nx][ny]==0) continue;
                // cout<<g[nx][ny]<<" "<<nx<<" "<<ny<<"!!!\n";
                // continue;
                if(judge({x,y},{nx,ny})==0) continue;
                // cout<<"?\n";
                array<int,2> c={nx+nx-x,ny+ny-y};
                // cout<<c[0]<<" "<<c[1]<<"!\n";
                if(f[c[0]][c[1]]==0) {
                    f[c[0]][c[1]]=1;
                    q.push(c);
                }
            }
        }
        int res=0;
        FOR(i,1,17) FOR(j,1,17) res+=f[i][j];
        ans+=res-1;
        // cout<<i<<" "<<j<<" "<<rses-1<<"\n";
        g[i][j]=1;
    }
    cout<<ans<<"\n";
}
signed main() {
    int T=read();
    while(T--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3368kb

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: 12ms
memory: 3424kb

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:

291
570
310
649
530
385
193
45
443
93
1
292
113
117
25
191
532
390
10
263
174
234
537
16
112
422
438
601
231
91
293
450
25
10
119
229
584
357
53
272
394
50
10
276
79
261
31
175
516
126
264
435
0
105
120
71
22
5
79
210
207
26
575
205
295
4
67
0
356
142
129
469
0
506
93
112
92
435
90
29
673
591
7
318
...

result:

wrong answer 1st numbers differ - expected: '190', found: '291'