QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#326187#2521. KeystrokeRabeya#AC ✓0ms3808kbC++201.5kb2024-02-12 15:48:302024-02-12 15:48:30

Judging History

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

  • [2024-02-12 15:48:30]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3808kb
  • [2024-02-12 15:48:30]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef unordered_map<int,int> umap;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define popcount __builtin_popcount
#define case cout<<"Case "<<__testcase-testcase<<": ";
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcase=1;
    cin>>testcase;
    int __testcase=testcase;
    while(testcase--){
        int m,n;
        cin>>m>>n;
        vector<int> row,clm;
        for(int i=0;i<m;i++) {
            int x;
            cin>>x;
            row.pb(x);
        }
        for(int i=0;i<n;i++) {
            int x;
            cin>>x;
            clm.pb(x);
        }
        sort(row.begin(),row.end());
        sort(clm.begin(),clm.end());

        int ans=0;
        for(int i=0;i<(1<<4);i++)
        {
            set<int> sr,sc;
            for(int j=0;j<4;j++)
            {
                if(i&(1<<j)){
                    int rw=j/2;
                    sr.insert(rw);
                    sc.insert(j%2);
                }
            }
            vector<int> vr,vc;
            for(auto i:sr) vr.pb(i);
            for(auto i:sc) vc.pb(i);
            if(vr==row and vc==clm) ans++;
        }
        cout<<ans<<endl;

    }
}





Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

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