Submission #00080


ソースコード

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
#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define lb(v,a) lower_bound(v.begin(),v.end(),a)
#define ub(v,a) upper_bound(v.begin(),v.end(),a)
#define bs(v,a) binary_search(v.begin(),v.end(),a)
#define bitcount(i) __builtin_popcount(i)
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vector<pair<long long,string>> p(n);
long long gou = -1;
for(int i = 0;i < n;i++){
long long a;
string s;
cin>>s>>a;
if(s == "gousuper"){
gou = a;
}
p[i] = make_pair(a,s);
}
int k = 0;
if(gou != -1){
for(int i = 0;i < n;i++){
if(gou < p[i].first){
k++;
}
}
}
if(k > n/2){
sort(p.begin(),p.end());
for(int i = 0;i < p.size();i++){
cout<<i + 1<<" "<<p[i].second<<"\n";
}
}else{
sort(p.rbegin(),p.rend());
for(int i = 0;i < p.size();i++){
cout<<i + 1<<" "<<p[i].second<<"\n";
}
}
return(0);
}

ステータス

項目 データ
問題 0006 - GouSorter2(easy)
ユーザー名 r2213
投稿日時 2023-07-18 16:50:29
言語 C++17
状態 Accepted
得点 100
ソースコード長 1146 Byte
最大実行時間 27 ms
最大メモリ使用量 748 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in-01.txt AC 24 ms 476 KB
1
in-02.txt AC 27 ms 552 KB
1
in-03.txt AC 21 ms 620 KB
1
in-04.txt AC 18 ms 576 KB
1
in-05.txt AC 22 ms 516 KB
1
in-06.txt AC 24 ms 592 KB
1
in-07.txt AC 22 ms 656 KB
1
in-08.txt AC 19 ms 592 KB
1
in-09.txt AC 21 ms 680 KB
1
in-10.txt AC 19 ms 748 KB
1