結果

問題 No.164 ちっちゃくないよ!!
ユーザー kohei2019kohei2019
提出日時 2021-09-01 00:17:22
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,709 bytes
コンパイル時間 3,508 ms
コンパイル使用メモリ 136,132 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 15:07:58
合計ジャッジ時間 4,334 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll,ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define INF 100000000
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//x:コンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //問題による
#define F first
#define S second
//出力(空白区切りで昇順に)
#define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()<<endl
#define coutALLn(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<endl;cout<<*--x.end()<<endl
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}

int main(){
    int N;
    cin >> N;
    vector<string> lsV(N);
    rep(i,N) cin >> lsV[i];
    string S = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    map<char,ll> cnv;
    rep(i,36){
        cnv[S[i]] = i;
    }
    ll ans = INF64;
    ll val;
    REP(i,N){
        int lens = lsV[i].size();
        ll val = 0;
        ll p = 1;
        ll mx = 1;
        for (const auto & m : lsV[i]){
            mx = max(mx,cnv[m]+1);
        }
        REP(j,lens){
            val += cnv[lsV[i][lens-j-1]]*p;
            p *= mx;
        }
        ans = min(ans,val);
    }
    
    cout << ans << endl;
}
0