結果
| 問題 | No.164 ちっちゃくないよ!! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-03-18 00:49:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,084 bytes |
| 記録 | |
| コンパイル時間 | 890 ms |
| コンパイル使用メモリ | 81,752 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 23:07:41 |
| 合計ジャッジ時間 | 1,437 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 10 |
ソースコード
#include <cstdint>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int N;
vector<string> V;
map<size_t, vector<string>> M;
void input(istream& in)
{
in >> N;
V.resize(N);
for (int i = 0; i < N; i++) {
in >> V[i];
}
}
struct less_string
{
bool operator()(const string& a, const string& b) const
{
return a < b;
}
};
int64_t resolve()
{
int base = 0x7F;
for (string& s : V) {
for (char ch : s) {
if (ch > base) {
base = ch;
}
}
size_t nz = s.find_first_not_of('0');
M[s.length() - nz].push_back(s.substr(nz));
}
base = (base < 'A') ? (base - '0') : (base - 'A' + 10);
base++;
vector<string>& shortest_strings = M.begin()->second;
string& smallest_value = *min_element(shortest_strings.begin(), shortest_strings.end(), less_string());
int64_t value = 0;
for (char ch : smallest_value) {
value *= base;
value += (ch < 'A') ? (ch - '0') : (ch - 'A' + 10);
}
return value;
}
int main()
{
input(cin);
cout << resolve() << endl;
return 0;
}