QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#180151#5682. PSETYshanqianAC ✓27ms128832kbC++141.6kb2023-09-15 16:10:032023-09-15 16:10:04

Judging History

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

  • [2023-09-15 16:10:04]
  • 评测
  • 测评结果:AC
  • 用时:27ms
  • 内存:128832kb
  • [2023-09-15 16:10:03]
  • 提交

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<string, string> 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;
PII p[N], t[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(PII a, PII b, PII c)
{
  for (int i = 0; i < (1 << 3); i++)
  {
    t[0] = a, t[1] = b, t[2] = c;
    for (int j = 0; j < 3; j++)
      if (i >> j & 1)
        swap(t[j].xx, t[j].yy);
    for (int j = 0; j < 3; j++)
      if (judge(t[0].xx, t[1].xx, t[2].xx) && judge(t[0].yy, t[1].yy, t[2].yy))
        return true;
  }
  return false;
}
void solve()
{
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> p[i].xx >> p[i].yy;
  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(p[i], p[j], p[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: 12ms
memory: 128492kb

input:

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

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 18ms
memory: 128832kb

input:

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

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 24ms
memory: 128556kb

input:

20
1BFD 3RED
1GEO 3GFA
2BEO 2RFA
3RSD 1BSD
1GSO 3GSA
2GFO 2GEA
2BSO 2RSA
2GEO 2GFA
1BFO 3REA
2RED 2BFD
1RFA 3BEO
2BFO 2REA
3BSD 1RSD
3REO 1BFA
1GSD 3GSD
3BSO 1RSA
3BFO 1REA
3RFO 1BEA
1BSA 3RSO
3RFD 1BED

output:

56

result:

ok single line: '56'

Test #4:

score: 0
Accepted
time: 15ms
memory: 128532kb

input:

13
2BFO 2REA
3GEO 1GFA
3GFA 1GEO
2BEO 2RFA
1GSA 3GSO
3BFD 1RED
2RFD 2BED
1GEA 3GFO
3BFA 1REO
2RED 2BFD
1BFO 3REA
1RSO 3BSA
1BED 3RFD

output:

16

result:

ok single line: '16'

Test #5:

score: 0
Accepted
time: 27ms
memory: 128608kb

input:

17
3RED 1BFD
1RSD 3BSD
1GFD 3GED
2RFA 2BEO
3GFO 1GEA
3RFD 1BED
2BSO 2RSA
2REA 2BFO
3RSA 1BSO
3BEA 1RFO
2BFD 2RED
1BEO 3RFA
2GFO 2GEA
3GSD 1GSD
1RFD 3BED
1REO 3BFA
2GED 2GFD

output:

37

result:

ok single line: '37'

Test #6:

score: 0
Accepted
time: 23ms
memory: 128492kb

input:

14
3BSO 1RSA
3GED 1GFD
1REO 3BFA
3RED 1BFD
1RSO 3BSA
1RFO 3BEA
1RFA 3BEO
3RSO 1BSA
3GEO 1GFA
3BFD 1RED
2GFO 2GEA
2RSA 2BSO
3GFA 1GEO
2BED 2RFD

output:

21

result:

ok single line: '21'

Test #7:

score: 0
Accepted
time: 27ms
memory: 128616kb

input:

17
3RSO 1BSA
3BED 1RFD
3RSA 1BSO
1RSO 3BSA
3GED 1GFD
3BEO 1RFA
2BFA 2REO
1RFO 3BEA
3BFD 1RED
1RSD 3BSD
1GFO 3GEA
2REA 2BFO
3BFA 1REO
1REA 3BFO
1BFA 3REO
2RSA 2BSO
2GEO 2GFA

output:

34

result:

ok single line: '34'

Test #8:

score: 0
Accepted
time: 16ms
memory: 128756kb

input:

6
3BFD 1RED
2GEO 2GFA
1REO 3BFA
2GFO 2GEA
1RSD 3BSD
2BFA 2REO

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 16ms
memory: 128596kb

input:

16
1RSA 3BSO
1GFO 3GEA
2GFA 2GEO
3BFA 1REO
2GSO 2GSA
1BFD 3RED
3GSO 1GSA
2RSO 2BSA
1BEO 3RFA
3GSD 1GSD
3BED 1RFD
3REA 1BFO
1GEO 3GFA
2RSA 2BSO
1GFA 3GEO
1RED 3BFD

output:

28

result:

ok single line: '28'

Test #10:

score: 0
Accepted
time: 15ms
memory: 128536kb

input:

6
2BSO 2RSA
2GFO 2GEA
3RFA 1BEO
1BFA 3REO
1GEA 3GFO
2GFD 2GED

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 12ms
memory: 128620kb

input:

4
3GSD 1GSD
3BFD 1RED
2BSA 2RSO
2RSD 2BSD

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 16ms
memory: 128536kb

input:

6
3GEO 1GFA
3RFD 1BED
2GFA 2GEO
1GFD 3GED
3BSD 1RSD
2GFD 2GED

output:

1

result:

ok single line: '1'

Test #13:

score: 0
Accepted
time: 20ms
memory: 128600kb

input:

4
3GFA 1GEO
2GSO 2GSA
3GED 1GFD
1BED 3RFD

output:

0

result:

ok single line: '0'

Test #14:

score: 0
Accepted
time: 15ms
memory: 128616kb

input:

11
3RFO 1BEA
3BSD 1RSD
3GFD 1GED
2GFA 2GEO
3RSD 1BSD
3GSD 1GSD
2REO 2BFA
1GFO 3GEA
1RFD 3BED
1BFA 3REO
3BSA 1RSO

output:

10

result:

ok single line: '10'

Test #15:

score: 0
Accepted
time: 24ms
memory: 128540kb

input:

15
2BED 2RFD
3BEA 1RFO
3GFO 1GEA
3GSA 1GSO
3GEA 1GFO
2RFA 2BEO
1BFO 3REA
3BFO 1REA
1RFD 3BED
3GSD 1GSD
1BFA 3REO
1REO 3BFA
1RED 3BFD
2RSD 2BSD
1GED 3GFD

output:

20

result:

ok single line: '20'