結果

問題 No.3042 本棚
ユーザー raven7959raven7959
提出日時 2022-05-11 17:30:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,510 bytes
コンパイル時間 2,814 ms
コンパイル使用メモリ 212,532 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-26 07:33:34
合計ジャッジ時間 4,757 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,388 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,388 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/bits/stl_algobase.h:64,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/bits/specfun.h:45,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/cmath:1935,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:41,
         次から読み込み:  main.cpp:1:
コンストラクタ ‘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 <無名> = true; _T1 = std::__cxx11::basic_string<char>; _T2 = int]’ 内,
    inlined from ‘constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = __cxx11::basic_string<char>&; _T2 = int&]’ at /usr/local/gcc7/include/c++/12.2.0/bits/stl_pair.h:746:72,
    inlined from ‘void solve()’ at main.cpp:85:23:
/usr/local/gcc7/include/c++/12.2.0/bits/stl_pair.h:535:42: 警告: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
  535 |         : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: 関数 ‘void solve()’ 内:
main.cpp:83:13: 備考: ‘x’ はここで定義されています
   83 |         int x;
      |             ^

ソースコード

diff #

#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2")
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define yn(joken) cout<<((joken) ? "Yes" : "No")<<"\n"
#define YN(joken) cout<<((joken) ? "YES" : "NO")<<"\n"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vld = vector<long double>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvs = vector<vector<string>>;
using vvc = vector<vector<char>>;
using vvd = vector<vector<double>>;
using vvld = vector<vector<long double>>;
using vvvi = vector<vector<vector<int>>>;
using vvvl = vector<vector<vector<ll>>>;
using vvvvi = vector<vector<vector<vector<int>>>>;
using vvvvl = vector<vector<vector<vector<ll>>>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
const int INF = 1e9;
const ll LINF = 2e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
bool ispow2(int i) { return i && (i & -i) == i; }
bool ispow2(ll i) { return i && (i & -i) == i; }
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        os << v[i];
        if (i < int(v.size()) - 1) os << ' ';
    }
    return os;
}

void solve(){
    int N;
    cin>>N;
    vector<pair<string,int>> V(N);
    vs X={"iti","ni","san","yon"};
    rep(i,N){
        string S,T;
        cin>>S>>T;
        int x;
        rep(i,4) if(X[i]==T) x=i+1;
        V[i]=make_pair(S,x);
    }
    sort(all(V));
    rep(i,N){
        cout<<V[i].first<<" "<<X[V[i].second-1]<<endl;
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();
}
0