結果
問題 | No.8042 本棚 |
ユーザー | しんじ |
提出日時 | 2024-11-17 18:00:40 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 707 bytes |
コンパイル時間 | 2,229 ms |
コンパイル使用メモリ | 181,256 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 18:00:43 |
合計ジャッジ時間 | 2,913 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 2 ms
5,248 KB |
testcase_15 | AC | 3 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | AC | 2 ms
5,248 KB |
testcase_19 | AC | 2 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | AC | 2 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 2 ms
5,248 KB |
testcase_26 | AC | 2 ms
5,248 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:64, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/string:50, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/locale_classes.h:40, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/ios_base.h:41, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:42, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54, from main.cpp:1: In constructor 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = std::__cxx11::basic_string<char>&; _U2 = int&; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true; _T1 = std::__cxx11::basic_string<char>; _T2 = int]', inlined from 'int main()' at main.cpp:21:15: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_pair.h:535:42: warning: 'num' may be used uninitialized [-Wmaybe-uninitialized] 535 | : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp: In function 'int main()': main.cpp:16:21: note: 'num' was declared here 16 | int num; | ^~~
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < int(n); i++) using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int n; cin >> n; vector<pair<string,int>> vp; rep(i,n){ string s,t; cin >> s >> t; int num; if(t == "iti") num = 1; else if(t == "ni") num = 2; else if(t == "san") num = 3; else if(t == "yon") num = 4; vp.push_back({s,num}); } sort(vp.begin(),vp.end()); for(auto v : vp){ cout << v.first << " "; if(v.second == 1) cout << "iti" << endl; else if(v.second == 2) cout << "ni" << endl; else if(v.second == 3) cout << "san" << endl; else if(v.second == 4) cout << "yon" << endl; } return 0; }