QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689361#1965. Trioproven#WA 1ms3976kbC++20997b2024-10-30 16:34:332024-10-30 16:34:34

Judging History

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

  • [2024-10-30 16:34:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3976kb
  • [2024-10-30 16:34:33]
  • 提交

answer

#include <bits/stdc++.h>
//#pragma
using namespace std;

#define endl '\n'


int n;
string s[2005];
bitset<2005> a[2005][20];

void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
    }
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++) {
            int zt = 0;
            for (int k = 0; k <= 3; k++)
                if (s[i][k] == s[i][k])
                    zt |= 1 << k;
            a[i][zt][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 = 0; k <= 3; k++)
                if (s[i][k] == s[i][k])
                    zt |= 1 << k;
            ans += (a[i][zt] & a[j][zt]).count();
        }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int 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: 1ms
memory: 3572kb

input:

4
1234
2345
3456
4567

output:

4

result:

ok single line: '4'

Test #2:

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

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: 3680kb

input:

9
1239
2349
3459
4569
5679
6789
7899
8919
9129

output:

84

result:

ok single line: '84'

Test #4:

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

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: 3648kb

input:

9
1234
2345
3456
4567
5678
6789
7891
8912
9123


output:

84

result:

ok single line: '84'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3976kb

input:

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

output:

816

result:

wrong answer 1st lines differ - expected: '168', found: '816'