QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708738#5682. PSETmgoldy925#WA 0ms3580kbC++111.2kb2024-11-04 04:59:582024-11-04 04:59:59

Judging History

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

  • [2024-11-04 04:59:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-11-04 04:59:58]
  • 提交

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'