QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#180073 | #5682. PSET | Yshanqian | WA | 13ms | 66284kb | C++14 | 1.6kb | 2023-09-15 15:19:51 | 2023-09-15 15:19:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define xx first
#define yy second
#define endl "\n"
#define lowbit(x) x & (-x)
#define int long long
#define ull unsigned long long
#define pb push_back
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define Ysanqian ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int N = 1e6 + 10, M = 1010, inf = 0x3f3f3f3f, mod = 18446, P = 13331;
const double eps = 1e-8;
int n, ans;
string s, p;
struct node
{
string s, p;
} a[N];
bool check(node a, node b, node c)
{
string s[3] = {a.s, b.s, c.s};
string p[3] = {a.p, b.p, c.p};
for (int i = 0; i <= 3; i++)
{
int num1 = 0, num2 = 0;
if (i < 3)
swap(s[i], p[i]);
for (int j = 0; j < 5; j++)
{
if (s[0][j] = !s[1][j] && s[0][j] != s[2][j] && s[1][j] != s[2][j] && p[0][j] != p[1][j] && p[1][j] != p[2][j] && p[2][j] != p[0][j])
return true;
if (s[0][j] == s[1][j] == s[2][j])
num1++;
if (p[0][j] == p[1][j] == p[2][j])
num2++;
}
if (i < 3)
swap(s[i], p[i]);
if (num1 <= 1 && num2 <= 1)
return true;
}
return false;
}
void solve()
{
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i].s >> a[i].p;
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
for (int k = j + 1; k <= n; k++)
if (check(a[i], a[j], a[k]))
ans++;
cout << ans << endl;
}
signed main()
{
Ysanqian;
int T;
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: 13ms
memory: 65984kb
input:
4 3BFD 1RED 1GSA 3GSO 3REA 1BFO 2REO 2BFA
output:
4
result:
ok single line: '4'
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 66284kb
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'