結果
| 問題 |
No.8042 本棚
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-01 21:17:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 805 bytes |
| コンパイル時間 | 2,340 ms |
| コンパイル使用メモリ | 185,128 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 01:41:07 |
| 合計ジャッジ時間 | 3,153 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
コンパイルメッセージ
main.cpp: In function 'bool comp(P, P)':
main.cpp:39:18: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
39 | return x<y;
| ^
main.cpp:27:15: note: 'y' was declared here
27 | int x,y,i;
| ^
main.cpp:39:18: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
39 | return x<y;
| ^
main.cpp:27:13: note: 'x' was declared here
27 | int x,y,i;
| ^
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<string, string> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
void add_mod(ll& a, ll b){
a += b;
if(a>MOD){
a -= MOD;
}
}
vector<P> v;
string smpl="insy";
bool comp(P a, P b){
int x,y,i;
if(a.first!=b.first){
return a.first<b.first;
}
for(i=0; i<4; ++i){
if(a.second[0]==smpl[i]){
x = i;
}
if(b.second[0]==smpl[i]){
y = i;
}
}
return x<y;
}
int main(void){
int n,i;
string s,t;
cin >> n;
for(i=0; i<n; ++i){
cin >> s >> t;
v.push_back(P(s,t));
}
sort(v.begin(),v.end());
for(i=0; i<n; ++i){
cout << v[i].first << " " << v[i].second << endl;
}
return 0;
}