QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103660#6305. Chinese CheckerMIT01#WA 8ms3444kbC++171.6kb2023-05-07 06:41:132023-05-07 06:41:16

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-07 06:41:16]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3444kb
  • [2023-05-07 06:41:13]
  • 提交

answer

#pragma GCC optimize("-Ofast","-ffast-math","-funroll-all-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pl pair<ll, ll>
#define db double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int T;
int s[17][2]={
{0,0},
{0,1},
{0,2},
{0,3},
{-4,8},
{-3,8},
{-2,8},
{-1,8},
{0,8},
{0,9},
{0,10},
{0,11},
{0,12},
{5,8},
{6,8},
{7,8},
{8,8}
};
int n,f[20][20],g[20][20],ans=0,V=0;
int dx[]={0,1,1,0,-1,-1},dy[]={1,0,1,-1,0,-1};
void dfs(int x,int y) {
    if(g[x][y]==V) return;
    g[x][y]=V; ++ans;
    for(int d=0;d<6;++d) {
        int xx=x,yy=y,go=0;
        while(1) {
            xx+=dx[d],yy+=dy[d];
            if(xx>=0&&xx<=16&&yy>=s[xx][0]&&yy<=s[xx][1]);
            else break;
            if(f[xx][yy]) {go=1; break;}
        }
        if(!go) continue;
        int x2=xx*2-x,y2=yy*2-y;
        if(x2>=0&&x2<=16&&y2>=s[x2][0]&&y2<=s[x2][1]&&!f[x2][y2]) dfs(x2,y2);
    }
}
void sol() {
    cin>>n;
    memset(f,0,sizeof f);
    for(int i=0;i<n;++i) {
        int x,y;
        cin>>x>>y;
        --x;
        y=y-1+s[x][0];
        f[x][y]=1;
    }
    ans=0;
    for(int i=0;i<20;++i)
        for(int j=0;j<20;++j) if(f[i][j]==1){
            f[i][j]=0; ++V; --ans;
            dfs(i,j);
            // cout<<i<<","<<j<<":"<<ans<<" "<<s[i][0]<<","<<s[i][1]<<"\n";
            f[i][j]=1;
        }
    printf("%d\n",ans);
}
int main() {
    int aa=0;
    for(int i=0;i<=16;++i) s[i][0]+=4,s[i][1]+=4,aa+=s[i][1]-s[i][0]+1;
    // cout<<aa<<"\n";
    cin>>T;
    while(T--) sol();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3428kb

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: 3444kb

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'