QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#689339#1965. Triok1nsom#WA 1ms5984kbC++231.3kb2024-10-30 16:27:032024-10-30 16:27:03

Judging History

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

  • [2024-10-30 16:27:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5984kb
  • [2024-10-30 16:27:03]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define endl '\n'
const int N = 2e3 + 5;
int n, a[N][5], jc[N];
bitset<N> cnt[N][20];
int C(int n, int k)
{
    return jc[n] / jc[k] / jc[n - k];
}
void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        string s;
        cin >> s;
        for (int j = 1; j <= 4; j++)
            a[i][j] = s[j] - '0';
    }
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            if (i != j)
            {
                int st = 0;
                for (int k = 1; k <= 4; k++)
                    if (a[i][k] == a[j][k])
                        st |= 1 << (k - 1);
                cnt[i][st][j] = 1;
            }
    int ans = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
        {
            int zt = 0;
            for (int k = 1; k <= 4; k++)
                if (a[i][k] == a[j][k])
                    zt |= 1 << (k - 1);
            auto tmp = cnt[i][zt] & cnt[j][zt];
            ans += tmp.count();
        }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    // cin>>t;
    jc[0] = 1;
    for (int i = 1; i <= 10; i++)
        jc[i] = i * jc[i - 1];
    while (t--)
        solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3796kb

input:

4
1234
2345
3456
4567

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

9
1299
2399
3499
4599
5699
6799
7899
8999
9199

output:

84

result:

ok single line: '84'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

9
1239
2349
3459
4569
5679
6789
7899
8919
9129

output:

84

result:

ok single line: '84'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

9
1999
2999
3999
4999
5999
6999
7999
8999
9999

output:

84

result:

ok single line: '84'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

9
1234
2345
3456
4567
5678
6789
7891
8912
9123


output:

84

result:

ok single line: '84'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

18
1211
2311
3411
4511
5611
6711
7811
8911
9111
1222
2322
3422
4522
5622
6722
7822
8922
9122

output:

168

result:

ok single line: '168'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

17
1211
2311
3411
4511
5611
6711
7811
8911
9111
1231
2341
3451
4561
5671
6781
7891
9121

output:

336

result:

ok single line: '336'

Test #8:

score: 0
Accepted
time: 1ms
memory: 5984kb

input:

81
1211
2311
3411
4511
5611
6711
7811
8911
9111
1222
2322
3422
4522
5622
6722
7822
8922
9122
1233
2333
3433
4533
5633
6733
7833
8933
9133
1244
2344
3444
4544
5644
6744
7844
8944
9144
1255
2355
3455
4555
5655
6755
7855
8955
9155
1266
2366
3466
4566
5666
6766
7866
8966
9166
1277
2377
3477
4577
5677
67...

output:

43848

result:

ok single line: '43848'

Test #9:

score: -100
Wrong Answer
time: 1ms
memory: 3636kb

input:

17
3433
3443
3444
3434
3333
3334
3343
3344
4333
4343
4334
4344
4433
4434
4444
4443
5678

output:

16

result:

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