QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#105400#5499. Aliasescciafrino#Compile Error//C++171.8kb2023-05-14 00:08:242023-05-14 00:08:26

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-14 00:08:26]
  • 评测
  • [2023-05-14 00:08:24]
  • 提交

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;
        }
        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 == 0 || a+b+c == 0|| a+b+c > 6) continue;
                    if (S[i][0].size() < a || S[i][0].size() < b) continue;
                    
                    for (int i = 0; i < N; ++i) {
                        string P = S[i][0].substr(0, a) + S[i][1].substr(0, b);
                        // cout << P << endl;
                        freq[P] += 1;
                    }
                    bool is_ok = true;
                    
                    for (auto& [s, val] : freq) {
                        // cout << "oi" << endl;
                        int dig = log10(val)+1;
                        // cout << val << ' ' << dig << endl;
                        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;
                    }
                }   
            }
        }
        if (cur_sum > 10 && N < 10) {
            if (cur_sum > N) {
                ans = {0, 0, N-1};
            }
        }
        cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:22:27: error: ‘i’ was not declared in this scope
   22 |                     if (S[i][0].size() < a || S[i][0].size() < b) continue;
      |                           ^