QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#180133#5682. PSETYshanqianRE 0ms0kbC++141.6kb2023-09-15 15:57:022023-09-15 15:57:02

Judging History

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

  • [2023-09-15 15:57:02]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-09-15 15:57:02]
  • 提交

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 judge(string a, string b, string c)
{
  set<char> s[10];
  for (int i = 0; i < 4; i++)
    s[i].insert(a[i]), s[i].insert(b[i]), s[i].insert(c[i]);
  for (int i = 0; i < 4; i++)
    if (s[i].size() == 2)
      return false;
  return true;
}
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 < (1 << 3); i++)
  {
    for (int j = 0; j < 3; j++)
      if (i >> j & 1)
      {
        swap(s[i], p[i]);
        if (judge(s[0], s[1], s[2]) && judge(p[0], p[1], p[2]))
          return true;
        swap(s[i], p[i]);
      }
  }
  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;
}

详细

Test #1:

score: 0
Dangerous Syscalls

input:

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

output:


result: