QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#105336#5499. Aliasescciafrino#WA 0ms3672kbC++171.5kb2023-05-13 22:24:322023-05-13 22:24:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-13 22:24:33]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2023-05-13 22:24:32]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int T; cin >> T;

    while (T--) {
        int N; cin >> N;
        vector<array<string, 2>> S(N);
        for (auto& [n, s] : S) {
            cin >> n >> s;
        }
        vector<int> pw(10);
        pw[0] = 1;
        for (int i = 1; i < 10; ++i) {
            pw[i] = pw[i - 1] * 10;
        }
        map<string, int> freq;
        array<int, 3> ans = {0, 0, 0};
        int cur_sum = 100000000;
        for (int a = 0; a < 7; ++a) {
            for (int b = 0; b < 7; ++b) {
                for (int c = 0; c < 7; ++c) {
                    if (a+b+c == 0 || a+b+c > 6) continue;
                    for (int i = 0; i < N; ++i) {
                        string P = S[i][0].substr(0, a) + S[i][1].substr(0, b);
                        freq[P] += 1;
                    }
                    bool is_ok = true;
                    
                    for (auto& [s, val] : freq) {
                        int dig = log10(val);
                        if (dig > c) {
                            is_ok = false;
                        }
                    }

                    if (!is_ok) continue;

                    if (a+b+c < cur_sum) {
                        ans = {a, b, c};
                        cur_sum = a+b+c;
                    }
                }   
            }
        }
        cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3672kb

input:

1
11
sven eriksson
erik svensson
sven svensson
erik eriksson
bjorn eriksson
bjorn svensson
bjorn bjornsson
erik bjornsson
sven bjornsson
thor odinsson
odin thorsson

output:

0 0 1

result:

wrong answer Loginy nieunikalne! (test case 1)