結果

問題 No.164 ちっちゃくないよ!!
ユーザー phsplsphspls
提出日時 2020-04-05 13:53:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 171,752 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 06:35:50
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long
#define ullong unsigned long long

int main() {
    int n;
    cin >> n;
    
    string rval = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    map<char, int> rankmap;
    rep(i, rval.length()) rankmap[rval[i]] = i;

    ullong minval = ULLONG_MAX;
    rep(i, n) {
        string s;
        cin >> s;
        int rank = 2;
        rep(j, s.length()) rank = max(rankmap[s[j]] + 1, rank);
        reverse(s.begin(), s.end());
        ullong val = 0;
        ullong rankval = 1;
        for(char c: s) {
            val += rankmap[c] * rankval;
            rankval *= rank;
        }
        minval = min(minval, val);
    }

    cout << minval << endl;
}
0