QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#708738 | #5682. PSET | mgoldy925# | WA | 0ms | 3580kb | C++11 | 1.2kb | 2024-11-04 04:59:58 | 2024-11-04 04:59:59 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
string cards[20][2];
bool check_string(string a, string b, string c){
for(int i = 0; i < 4; i++){
if(a[i]==b[i]&&b[i]==c[i]) return true;
else if(a[i]!=b[i]&&a[i]!=c[i]&&b[i]!=c[i]) return true;
}
return false;
}
bool check(int i, int j, int k, bool flip){
// if flip = true, flip i
if(flip){
return check_string(cards[i][1],cards[j][0],cards[k][0]) && check_string(cards[i][0],cards[j][1],cards[k][1]);
}
else{
return check_string(cards[i][0],cards[j][0],cards[k][0]) && check_string(cards[i][1],cards[j][1],cards[k][1]);
}
}
int main(){
int N; cin >> N;
for(int i = 0; i < N; i++){
cin >> cards[i][0] >> cards[i][1];
}
int ans = 0;
for(int i = 0; i < N; i++){
for(int j = i+1; j < N; j++){
for(int k = j+1; k < N; k++){
bool flag = false;
if (check(i,j,k,false) ||
check(i,j,k,true) ||
check(j,k,i,true) ||
check(k,i,j,true)){
ans++;
}
}
}
}
cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
4 3BFD 1RED 1GSA 3GSO 3REA 1BFO 2REO 2BFA
output:
4
result:
ok single line: '4'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
7 3GED 1GFD 2RSD 2BSD 1BFA 3REO 2RED 2BFD 3GSD 1GSD 3BFO 1REA 2GEA 2GFO
output:
34
result:
wrong answer 1st lines differ - expected: '1', found: '34'