QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#254429#2521. Keystroketpc_icpc_n#AC ✓0ms3588kbC++20647b2023-11-18 12:31:042023-11-18 12:31:06

Judging History

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

  • [2023-11-18 12:31:06]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3588kb
  • [2023-11-18 12:31:04]
  • 提交

answer

#include <iostream>
#include <vector>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


void solve() {
    int m,n; cin >> m >> n;
    set<int> R,C;
    rep(i,m){
        int a; cin >> a; R.insert(a);
    }
    rep(i,n){
        int a; cin >> a; C.insert(a);
    }
    int ans = 0;
    rep(i,1<<4){
        set<int> r,c;
        rep(j,4){
            if((i>>j)&1){
                r.insert(j/2);
                c.insert(j%2);
            }
        }
        if(r==R && c==C) ans++;
    }
    cout << ans << '\n';
}

int main() {
    int T;
    std::cin >> T;
    while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

2
2 1
0 1
0
1 2
1
0 1

output:

1
1

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2
2 2
0 1
0 1
1 1
1
1

output:

7
1

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

9
1 1
0
0
1 1
0
1
1 1
1
0
1 1
1
1
1 2
0
0 1
1 2
1
0 1
2 1
0 1
0
2 1
0 1
1
2 2
0 1
0 1

output:

1
1
1
1
1
1
1
1
7

result:

ok 9 lines