QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#640556#7882. Linguistics Puzzlewzl19371Compile Error//C++141.7kb2024-10-14 14:16:492024-10-14 14:16:50

Judging History

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

  • [2024-10-14 14:16:50]
  • 评测
  • [2024-10-14 14:16:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
vector<int> cvt(int x, int k) {
    vector<int> s;
    while(x) {
        int c = x % k;
        x /= k;
        s.push_back(c);
    }
    if(s.size())
        s = vector(s.rbegin(), s.rend());
    else
        s = {0};
    return s;
}
void solve() {
    int n;
    cin >> n;
    int ct[n+5][3] = {};
    for(int i=0;i<n;i++) {
        for(int j=0;j<n;j++) {
            auto vec = cvt(i*j, n);
            for(int k=0;k<vec.size();k++) {
                ct[vec[k]][k]++;
            }
						if(vec.size() == 2 && vec[0] == vec[1])
								ct[vec[0]][2]++;
        }
    }
    
    int ct2[n+5][3] = {};
    for(int i=1;i<=n*n;i++) {
        string s; cin >> s;
        for(int k=0;k<s.size();k++) {
            if(islower(s[k]))
                ct2[s[k]-'a'][k]++;
            else
                ct2[s[k]-'A'+26][k]++;
        }
				if(s.size() == 2 && s[0] == s[1])
						ct2[s[0] + (islower(s[0]) ? (-'a') : (-'A'+26))][2]++;
    }

    bool v[n+5] = {};
    for(int i=0;i<n;i++) {
        for(int j=0;j<n;j++) {
            if(v[j]) continue;
            bool ok = true;
            for(int k=0;k<3;k++) {
                if(ct[i][k] != ct2[j][k]) {
                    ok = false;
                    break;
                }
            }
            if(ok) {
                v[j] = true;
                if(j < 26)
                    cout << char(j + 'a');
                else
                    cout << char(j - 26 + 'A');
                break;
            }
        }
    }
    cout << '\n';
}
int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    int t; cin >> t;
    while(t--) solve();
    return 0;
}

Details

answer.code: In function ‘std::vector<int> cvt(int, int)’:
answer.code:11:19: error: missing template arguments before ‘(’ token
   11 |         s = vector(s.rbegin(), s.rend());
      |                   ^