結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
Twizz
|
| 提出日時 | 2017-05-24 06:41:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 629 bytes |
| コンパイル時間 | 1,247 ms |
| コンパイル使用メモリ | 160,264 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 13:06:21 |
| 合計ジャッジ時間 | 1,987 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 5 WA * 10 |
コンパイルメッセージ
main.cpp:20:24: warning: multi-character character constant [-Wmultichar]
20 | char m='zz';
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:20:24: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘31354’ to ‘'z'’ [-Woverflow]
ソースコード
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
const ll mod = 10000000000;
int main() {
int n;
string s[52];
cin >> n;
REP(i, n) { cin >> s[i];}
string ans="";
while (true) {
char m='zz';
int mi=-1;
REP(i, n) {
if (s[i].empty())continue;
if (m > s[i].front()) {
m = s[i].front();
mi = i;
}
}
if (mi == -1)break;
ans += m;
s[mi].erase(s[mi].begin() + 0);
}
print(ans);
return 0;
}
Twizz