่งฃๆณไธ
โ ๅฎๆดไปฃ็ขผ
่ฉๅ็ตๆ(ๅ่) ๏ผ AC (0.4s, 356KB)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<int> pw(4); // Password
vector<int> in(4); // Input
int n;
while(cin >> pw[0] >> pw[1] >> pw[2] >> pw[3]){
cin >> n;
for(int i=0; i<n; i++){
cin >> in[0] >> in[1] >> in[2] >> in[3];
int a=0, b=0;
vector<int> temp = pw;
for(int j=0; j<4; j++){
if(in[j] == temp[j]){
a++;
temp[j] = -1;
in[j] = -2;
}
}
for(int j=0; j<4; j++){
for(int k=0; k<4; k++){
if(in[j] == temp[k]){
b++;
temp[k] = -1;
in[j] = -2;
}
}
}
cout << a << "A" << b << "B\n";
}
}
}