QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#710250 | #1979. Gratitude | becaido | AC ✓ | 87ms | 28468kb | C++20 | 1.1kb | 2024-11-04 19:11:57 | 2024-11-04 19:11:57 |
Judging History
answer
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifdef WAIMAI
#define debug(HEHE...) cout<<"["<<#HEHE<<"] : ",dout(HEHE)
void dout(){cout<<'\n';}
template<typename T,typename...U>
void dout(T t,U...u){cout<<t<<(sizeof...(u)?", ":""),dout(u...);}
#else
#define debug(...) 7122
#endif
#define int long long
#define ll long long
#define Waimai ios::sync_with_stdio(false),cin.tie(0)
#define FOR(x,a,b) for(int x=a,I=b;x<=I;x++)
#define pb emplace_back
#define F first
#define S second
int n, k;
map<string, pair<int, int>> mp;
void solve() {
cin >> n >> k;
cin.get();
FOR (i, 1, 3 * n) {
string s;
getline (cin, s);
if (mp.count (s)) mp[s].F++, mp[s].S = i;
else mp[s] = {1, i};
}
vector<tuple<int, int, string>> v;
for (auto [s, p] : mp) {
v.pb (-p.F, -p.S, s);
}
sort (v.begin(), v.end());
FOR (i, 0, min ((int) v.size(), k) - 1) cout << get<2> (v[i]) << '\n';
}
int32_t main() {
Waimai;
int tt = 1;
//cin >> tt;
while (tt--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
1 1 C B A
output:
A
result:
ok single line: 'A'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1 2 C B A
output:
A B
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1 3 C B A
output:
A B C
result:
ok 3 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
3 1 C B A A B C A B C
output:
C
result:
ok single line: 'C'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
3 3 C B A A B C A B C
output:
C B A
result:
ok 3 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
3 8 C B A A B C A B C
output:
C B A
result:
ok 3 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2 3 q w e r t y
output:
y t r
result:
ok 3 lines
Test #8:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 6 q w e r t y
output:
y t r e w q
result:
ok 6 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
3 2 A B C B C D C D E
output:
C D
result:
ok 2 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
3 3 A B C B C D C D E
output:
C D B
result:
ok 3 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3 5 A B C B C D C D E
output:
C D B E A
result:
ok 5 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
3 9 A B C B C D C D E
output:
C D B E A
result:
ok 5 lines
Test #13:
score: 0
Accepted
time: 68ms
memory: 12440kb
input:
33333 99999 21336 54674 65180 6629 63120 30823 92163 80025 50174 67734 879 35964 53935 12142 17604 60250 43015 30063 51541 40979 35454 6328 58642 78108 19028 78847 22766 73250 38610 89274 33675 12046 13983 75354 11269 75620 50011 49208 37912 54086 57755 22472 81134 44117 68226 40713 61097 56983 6639...
output:
19042 92712 60795 76384 24499 43145 12945 3376 7656 15306 79532 22 69151 61515 71569 5130 5795 89216 15511 80114 71141 82394 91849 46552 46246 29443 42195 6044 49931 19323 37134 78803 92422 4353 9070 7773 94490 35583 70515 89667 61457 46601 68936 9004 70491 50484 21666 9155 55315 76935 30732 90162 3...
result:
ok 63322 lines
Test #14:
score: 0
Accepted
time: 14ms
memory: 3624kb
input:
33333 99999 4 74 78 55 8 25 15 6 72 38 82 45 54 56 52 13 2 52 41 71 18 35 78 13 21 52 7 26 40 0 15 41 77 0 43 15 16 40 0 79 19 59 56 94 84 26 73 40 51 94 90 89 75 39 67 63 23 30 84 21 50 12 61 61 74 55 1 16 59 82 33 66 56 78 9 9 88 60 26 50 58 84 39 82 10 71 50 44 36 72 5 29 32 73 95 86 5 64 17 38 5...
output:
26 81 82 58 13 16 77 73 61 66 50 87 69 92 95 96 59 0 43 24 86 1 40 63 54 38 85 27 44 37 28 97 10 29 14 64 4 18 75 79 9 3 89 12 19 41 39 48 49 74 55 56 34 67 83 52 30 7 88 84 15 78 51 5 57 6 45 99 91 62 22 8 93 70 20 90 21 72 17 47 46 31 32 33 25 94 68 2 71 23 11 42 76 36 80 65 60 35 98 53
result:
ok 100 lines
Test #15:
score: 0
Accepted
time: 6ms
memory: 3604kb
input:
33333 99999 0 1 2 2 1 0 2 1 0 1 2 0 0 1 2 0 2 1 1 2 0 0 2 1 2 0 1 2 1 0 1 0 2 0 2 1 1 0 2 1 2 0 2 0 1 0 2 1 2 1 0 1 2 0 0 2 1 2 1 0 0 2 1 0 2 1 2 1 0 0 1 2 0 1 2 0 1 2 2 1 0 2 0 1 0 1 2 0 2 1 2 1 0 0 1 2 0 2 1 0 2 1 0 2 1 2 1 0 0 2 1 0 2 1 2 1 0 2 1 0 2 0 1 1 2 0 2 0 1 0 1 2 0 2 1 2 1 0 2 0 1 0 2 1 ...
output:
2 0 1
result:
ok 3 lines
Test #16:
score: 0
Accepted
time: 3ms
memory: 3896kb
input:
33333 99999 2 0 1 2 0 1 2 1 0 1 0 2 0 1 2 2 1 0 2 1 0 1 2 0 2 1 0 1 0 2 2 0 1 0 2 1 1 2 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 1 0 2 2 0 1 2 1 0 2 0 1 2 1 0 2 1 0 0 1 2 2 1 0 2 1 0 1 2 0 2 0 1 0 2 1 2 0 1 2 0 1 2 0 1 1 2 0 2 0 1 0 2 1 1 2 0 1 2 0 2 1 0 2 0 1 1 0 2 2 1 0 1 2 0 2 1 0 2 1 0 2 0 1 0 2 1 ...
output:
0 2 1
result:
ok 3 lines
Test #17:
score: 0
Accepted
time: 14ms
memory: 3696kb
input:
33333 99999 13 75 80 84 76 98 37 57 92 66 36 73 33 99 96 34 82 78 75 58 89 64 92 90 99 48 65 53 47 71 82 57 31 80 75 58 84 85 76 24 66 62 75 86 68 56 90 20 92 75 72 89 27 14 41 95 57 87 89 52 32 64 78 66 91 73 29 96 62 88 72 63 81 69 43 19 47 31 49 88 75 4 65 93 55 93 83 13 98 88 70 41 94 76 81 74 7...
output:
99 97 96 98 95 93 94 91 89 90 88 92 87 85 86 84 83 79 82 77 80 81 78 76 75 72 74 73 70 67 69 71 68 64 65 66 63 62 60 61 58 56 57 59 55 53 54 51 52 48 49 50 47 46 45 44 40 42 43 41 38 39 35 34 36 37 32 33 30 31 29 27 28 26 25 24 21 23 22 20 19 18 17 16 15 13 14 11 12 10 9 7 8 6 5 4 2 3 1 0
result:
ok 100 lines
Test #18:
score: 0
Accepted
time: 28ms
memory: 4092kb
input:
33333 99999 783 853 939 955 662 776 776 907 345 764 671 849 994 680 958 829 991 945 589 871 559 907 60 790 949 863 367 937 956 448 886 835 757 563 476 883 865 161 887 685 954 388 792 970 916 852 854 927 820 267 911 548 976 488 759 974 986 673 615 661 809 582 978 496 676 375 543 712 827 797 735 814 9...
output:
949 895 978 982 989 972 981 967 917 913 996 974 927 997 977 954 961 931 936 998 932 963 950 930 911 960 994 987 934 999 958 922 856 943 951 919 945 826 976 907 992 988 993 890 952 937 969 862 929 975 971 903 940 858 985 979 861 872 986 899 916 933 925 915 905 854 921 828 942 902 910 926 956 868 970 ...
result:
ok 996 lines
Test #19:
score: 0
Accepted
time: 73ms
memory: 17304kb
input:
33333 99999 nhxuwiy ksrgisczhqbptjlwpgsiqhcobiabtadklkslulwp wiuzbkomrvnqqjrrtjsghnqqhgnojxcyqjwlxpraymifqyizg ujvscflrbsdvocfpvxqhi skpthjfhbpzzektsjqpl pfpkco rzitpvvczobgaluiskgchqryqakqrahpekraujteehxukvgcz nhxuwiy ksrgisczhqbptjlwpgsiqhcobiabtadklkslulwp dzilpjqoobmerirmjhqseuxambeamznrfn pts...
output:
aou rckckqjfowys tsnfx olhsslmrlyotqloyybqvkb ft zayzdizaibmcntctnu er jnasoyfgfobjnveqrzgjtgfxel rzitpvvczobgaluiskgchqryqakqrahpekraujteehxukvgcz rqcwnifkguyzolcyinhuunsbjwzdlxsqgrfehctrxdsxmeaub edxgmnojftqcnwhhi bifnsfhwzyybg nnomnsgkudvrfkfac aocoofidff juy cplopnui qonkkwiqrelytmphrykfpaxx ...
result:
ok 49957 lines
Test #20:
score: 0
Accepted
time: 87ms
memory: 28468kb
input:
33333 99999 nhxuwiy ksrgisczhqbptjlwpgsiqhcobiabtadklkslulwp wiuzbkomrvnqqjrrtjsghnqqhgnojxcyqjwlxpraymifqyizg ujvscflrbsdvocfpvxqhi skpthjfhbpzzektsjqpl pfpkco rzitpvvczobgaluiskgchqryqakqrahpekraujteehxukvgcz yddzilpjqoobmerirmjhqseuxambeamznrfn ptskrxbmvabf nhxuwiy ksrgisczhqbptjlwpgsiqhcobiabt...
output:
z bdmlqykuljsozso bhnebkcjvi awaf ersylzij ckama lgoiwqjscpazrgpjqujjgtbofnnqsyjrrkgjggmxhxmiydchk cpywlqzeo wltqvjwxarihybfeuhisrhgiav n wqbeuclot qxiiwn zayzdizaibmcntctnu er jnasoyfgfobjnveqrzgj lwycy yfymzeckwgbjohdrmehajdnjopthl vzmpwhyiqgs h ylmjanoiaujwxexd ptlxddaigtcduxjjtp hrsrp ttuhus i...
result:
ok 90102 lines