QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#260074#6305. Chinese Checkerucup-team2235WA 232ms5348kbC++171.3kb2023-11-21 19:42:402023-11-21 19:42:41

Judging History

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

  • [2023-11-21 19:42:41]
  • 评测
  • 测评结果:WA
  • 用时:232ms
  • 内存:5348kb
  • [2023-11-21 19:42:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int l[18]={0,13,12,11,10,5,5,5,5,4,3,2,1,5,5,5,5},
  r[18]={0,13,13,13,13,17,16,15,14,13,13,13,13,8,7,6,5},
  dx[6]={-1,1,0,0,-1,1},dy[6]={0,0,-1,1,1,-1};
set<pii> m;
pair<pii,int> jump(pii a,int d,int s,int c=0){
  while(s--){
    a.first+=dx[d],a.second+=dy[d];
    if(m.find(a)!=m.end())c++;
  }
  return make_pair(a,c);
}
bool check(pii a){
  auto [x,y]=a;
  return x>0&&x<=17&&y>=l[x]&&y<=r[x];
}
int main(){
  ios::sync_with_stdio(false);
  int t; cin>>t;
  while(t--){
    int n; cin>>n;
    vector<pii> a(n);
    vector<set<set<pii> > > s(n+1);
    for(auto &[x,y]:a)cin>>x>>y,y+=l[x]-1;
    m.clear(); for(pii i:a)m.emplace(i);
    function<void(int)> dfs=[&](int i){
      s[i].emplace(m);
      for(int j=0;j<6;j++)
        for(int k=1;k<=6;k++)
          if(auto [p,c1]=jump(a[i],j,k);c1==1&&check(p)&&m.find(p)!=m.end()){
            auto [e,c2]=jump(p,j,k);
            if(!c2&&check(e)&&m.find(e)==m.end()){
              pii t=a[i];
              m.erase(a[i]),m.emplace(a[i]=e);
              if(s[i].find(m)==s[i].end())dfs(i);
              m.erase(e),m.emplace(a[i]=t);
            }
          }
    };
    for(int i=0;i<n;i++)
      dfs(i),s[n].merge(s[i]);
    cout<<s[n].size()-1<<endl;
  }
  return 0;
}

详细

Test #1:

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

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: 232ms
memory: 5348kb

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:

228
350
112
444
345
165
203
39
209
100
1
185
141
44
20
150
283
247
19
189
88
185
297
25
95
206
229
289
113
98
159
232
38
9
101
169
267
377
53
137
222
50
20
96
64
174
45
187
265
118
152
238
0
107
58
25
30
14
65
165
147
33
477
184
246
13
59
0
278
103
100
328
9
267
77
106
30
337
52
34
356
362
9
158
94
...

result:

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