Submission #37075


ソースコード

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using pii = pair<int,int>;
using ll = long long;
struct Student
{
char name[22];
ll ja, math, eng, sum;
Student() {}
Student(const char *s, ll j, ll m, ll e) : Student(j,m,e)
{
strcpy(name, s);
}
Student(ll j, ll m, ll e) : ja(j), math(m), eng(e), sum(j+m+e) {}
};
istream & operator >> (istream &is, Student &s)
{
char name[22];
ll j, m , e;
cin >> name >> j >> m >> e;
s = Student(name, j, m, e);
return is;
}
ostream & operator << (ostream &os, const Student &s)
{
os << s.name << ' '
<< s.ja << ' '
<< s.math << ' '
<< s.eng << ' '
<< s.sum;
return os;
}
int main()
{
cin.tie(0), ios::sync_with_stdio(false);
Student a[11];
Student *ptr[11];
int n;
cin >> n;
rep(i, n) {
cin >> a[i];
ptr[i] = a+i;
}
stable_sort(ptr, ptr+n, [](const Student *a, const Student *b) { return a->sum > b->sum; });
rep(i, n) {
outl(*ptr[i]);
}
}

ステータス

項目 データ
問題 0941 - 中間テスト
ユーザー名 Arumakan_ei1727
投稿日時 2018-06-12 00:08:06
言語 C++11
状態 Accepted
得点 1
ソースコード長 1247 Byte
最大実行時間 32 ms
最大メモリ使用量 728 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input001.txt AC 25 ms 480 KB
1
input002.txt AC 23 ms 536 KB
1
input003.txt AC 32 ms 728 KB
1
input004.txt AC 20 ms 540 KB
1
input005.txt AC 26 ms 480 KB
1