QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179552#5682. PSETwdbl857WA 14ms66004kbC++201.6kb2023-09-14 22:16:082023-09-14 22:16:09

Judging History

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

  • [2023-09-14 22:16:09]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:66004kb
  • [2023-09-14 22:16:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define int long long
#define endl "\n"
#define pi acos(-1)
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;
const int N = 1e6 + 10, M = 1010, INF = 0x3f3f3f3f, mod = 998244353;
struct node
{
    string a, b;
} s[N];
int asd(string a, string b, string c)
{
    for(int i=0;i<a.size();i++)
    {
        if(a[i]==b[i]&&a[i]!=c[i])return 0;
        if(a[i]==c[i]&&a[i]!=b[i])return 0;
    }
    return 1;
}
int check(int i, int j, int k)
{
    node x = s[i], y = s[j], z = s[k];
    if (asd(s[i].a, s[j].a, s[k].a))
        return 1;
    if (asd(s[i].a, s[j].a, s[k].b))
        ;
    return 1;
    if (asd(s[i].a, s[j].b, s[k].a))
        ;
    return 1;
    if (asd(s[i].b, s[j].a, s[k].b))
        ;
    return 1;
    if (asd(s[i].a, s[j].b, s[k].b))
        ;
    return 1;
    if (asd(s[i].b, s[j].a, s[k].b))
        ;
    return 1;
    if (asd(s[i].b, s[j].b, s[k].a))
        ;
    return 1;
    return 0;
}
void solve()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> s[i].a >> s[i].b;
    }
    int ans = 0;
    for (int i = 1; i <= n - 2; i++)
    {
        for (int j = i + 1; j <= n - 1; j++)
        {
            for (int k = j + 1; k <= n; k++)
            {
                if (check(i, j, k))
                    ans++;
            }
        }
    }
    cout << ans << endl;
}
signed main()
{
    ios;
    int T = 1;
    // cin >> T;
    while (T--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 66004kb

input:

4
3BFD 1RED
1GSA 3GSO
3REA 1BFO
2REO 2BFA

output:

4

result:

ok single line: '4'

Test #2:

score: -100
Wrong Answer
time: 14ms
memory: 65904kb

input:

7
3GED 1GFD
2RSD 2BSD
1BFA 3REO
2RED 2BFD
3GSD 1GSD
3BFO 1REA
2GEA 2GFO

output:

35

result:

wrong answer 1st lines differ - expected: '1', found: '35'