結果

問題 No.164 ちっちゃくないよ!!
コンテスト
ユーザー ngtkana
提出日時 2020-03-24 10:37:06
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 862µs
コード長 741 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,382 ms
コンパイル使用メモリ 212,664 KB
実行使用メモリ 9,900 KB
最終ジャッジ日時 2026-10-25 16:59:51
合計ジャッジ時間 2,856 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using lint=long long;
void cmx(lint&x,lint y){if(x<y)x=y;}
void cmn(lint&x,lint y){if(x>y)x=y;}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::string>a(n);
    for(auto&&s:a)std::cin>>s;
    auto cal=[&](char c){
        return std::isdigit(c)?c-'0':c-'A'+10;
    };
    lint ans=std::numeric_limits<lint>::max();
    for(auto&&s:a){
        lint base=0;
        for(char c:s){
            cmx(base,cal(c));
        }
        base++;
        lint now=0;
        for(char c:s){
            now=base*now+cal(c);
        }
        cmn(ans,now);
    }
    std::cout<<ans<<'\n';
}
0