結果
| 問題 |
No.8042 本棚
|
| コンテスト | |
| ユーザー |
ロク@マジミラ2023(幕張)9/1~9/3参加
|
| 提出日時 | 2023-08-03 01:45:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 562 bytes |
| コンパイル時間 | 1,986 ms |
| コンパイル使用メモリ | 178,784 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 23:50:32 |
| 合計ジャッジ時間 | 6,161 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 24 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:14:36: warning: 'n' is used uninitialized [-Wuninitialized]
14 | vector<pair<string, int>> sId(n);
| ^
main.cpp:13:9: note: 'n' declared here
13 | int n;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int strToi(string &s){
if(s == "iti") return 1;
else if(s == "ni") return 2;
else if(s == "san") return 3;
else if(s == "yon") return 4;
return 0;
}
int main() {
int n;
vector<pair<string, int>> sId(n);
cin >> n;
string tmp;
for(int i = 0; i < n; i++){
cin >> sId[i].first;
cin >> tmp;
sId[i].second = strToi(tmp);
}
sort(sId.begin(), sId.end());
for(const auto& str: sId){
cout << str.first << " " << str.second << endl;
}
}
ロク@マジミラ2023(幕張)9/1~9/3参加