QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#326187 | #2521. Keystroke | Rabeya# | AC ✓ | 0ms | 3808kb | C++20 | 1.5kb | 2024-02-12 15:48:30 | 2024-02-12 15:48:30 |
Judging History
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;
}
}
详细
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