Submission #57516


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout <<fixed<<setprecision(12);
cerr <<fixed<<setprecision(12);
}
}IoSetup;
typedef long long ll;
typedef pair < int , int > pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};
bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
signed main() {
int n;
cin >> n;
vector<string> a(n);
for(auto&&i:a) cin >> i;
sort(ALL(a), [](string a, string b) {
int x = a.size();
int y = b.size();
if(x==y) return a < b;
else return x < y;
});
for(auto&&i:a) cout << i << endl;
return 0;
}

ステータス

項目 データ
問題 1225 - std::sort
ユーザー名 ei1821
投稿日時 2019-12-18 00:09:11
言語 C++14
状態 Accepted
得点 10
ソースコード長 1607 Byte
最大実行時間 377 ms
最大メモリ使用量 58964 KB

セット

セット 得点 Cases
1 ALL 10 / 10 in*

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01-01.txt AC 34 ms 604 KB
1
in01-02.txt AC 26 ms 392 KB
1
in01-03.txt AC 24 ms 344 KB
1
in02-01.txt AC 23 ms 432 KB
1
in02-02.txt AC 22 ms 504 KB
1
in02-03.txt AC 50 ms 1416 KB
1
in02-04.txt AC 326 ms 10168 KB
1
in02-05.txt AC 322 ms 12748 KB
1
in02-06.txt AC 330 ms 15196 KB
1
in02-07.txt AC 330 ms 17892 KB
1
in02-08.txt AC 316 ms 20476 KB
1
in03-01.txt AC 19 ms 13692 KB
1
in03-02.txt AC 24 ms 13648 KB
1
in03-03.txt AC 363 ms 28096 KB
1
in03-04.txt AC 377 ms 33120 KB
1
in03-05.txt AC 349 ms 38020 KB
1
in03-06.txt AC 357 ms 43040 KB
1
in03-07.txt AC 374 ms 47936 KB
1
in03-08.txt AC 23 ms 38752 KB
1
in03-09.txt AC 209 ms 42036 KB
1
in03-10.txt AC 219 ms 42572 KB
1
in03-11.txt AC 322 ms 53860 KB
1
in03-12.txt AC 17 ms 44416 KB
1
in03-13.txt AC 303 ms 58964 KB
1
sample01.txt AC 16 ms 49524 KB
sample02.txt AC 16 ms 49608 KB