QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#179552 | #5682. PSET | wdbl857 | WA | 14ms | 66004kb | C++20 | 1.6kb | 2023-09-14 22:16:08 | 2023-09-14 22:16:09 |
Judging History
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;
}
详细
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'