-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathE.cpp
65 lines (62 loc) · 4.06 KB
/
E.cpp
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
#include<bits/stdc++.h>
using namespace std;
// Sekarang saya kasih signature
// Code Fakhri, #PAIMON OP
//⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⡀⠀⠀⠰⣿⣭⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⠶⠛⠋⠉⠉⠉⠉⠉⠉⠛⢳⡶⣿⣾⣿⡿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠀⠀⣀⣀⣤⣤⣤⣤⣤⣤⣼⣧⡟⣼⢋⣥⠶⠲⢦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣦⣀⠈⠉⠻⠦⣤⣀⣀⣀⣶⣿⣷⣟⠋⠙⠳⢦⣄⡀⠉⠛⠶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣈⣩⡿⠶⠶⠖⠲⠿⠿⠿⣿⣻⣿⣿⣦⣄⣀⠀⠈⠛⢶⣄⠀⠈⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⠀⠈⠉⠙⠛⠿⣿⣛⠛⠋⠻⠄⠀⠈⣷⠀⠀⠀⠀⠀⠀⠀
//⠀⢀⣀⡀⠀⠀⠀⣀⣠⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⣶⡶⠶⠶⠶⠟⠀⠀⠀⠀⠀⠀⠀
//⠀⢹⡍⠙⠛⠛⠋⠉⠁⠀⠀⠀⠀⣀⣀⣀⣀⣀⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠈⢷⣄⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣭⣍⣹⡏⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠂⠀⠀⠀⠀⠀⠀⠀⠈⢷⡄⠀⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⢙⣷⠀⠀⠀⣰⢟⣵⣿⣥⡀⠀⠀⠈⠻⣧⠀⠀⠀⠀⠀⠀⣠⠞⣿⠀⠀⠀⠀⠀⠀⢀⣧⠀⠀⠀⢻⡆⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⢠⡟⠁⠀⢀⣼⠋⣼⣿⣿⣿⣷⠀⠀⠀⠀⠘⣇⠀⠀⠀⢠⡾⠁⣀⣽⣦⣤⣀⡀⠀⢠⣾⠿⣧⣀⠀⠀⢻⣆⠀⠀⠀⠀⠀⠀
//⠀⢰⡟⠀⠀⢠⡾⠁⠀⢿⡛⠛⠛⠁⠀⠀⠀⠀⢠⣯⠀⠀⣰⠏⣰⣟⣉⡀⠀⠀⠈⠻⣶⣿⡛⠀⠈⣿⣷⠖⠀⠙⢷⣄⠀⠀⠀⠀
//⢠⡟⠀⢀⡠⠟⠀⠀⠀⠈⠻⣤⡀⠀⠀⠀⢀⣴⠟⠹⣆⢠⡏⢠⣿⣿⣿⣿⡆⠀⠀⠀⢹⡏⠻⣷⣶⡟⠁⠀⠀⠀⠀⠈⣻⡆⠀⠀
//⣼⠃⠀⠘⣤⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⣛⠉⠀⠀⠀⠙⢿⣇⠘⣟⠛⠟⠋⠀⠀⠀⠀⢰⣧⡀⠘⣿⠀⠀⠀⠀⢠⣤⠾⠋⠀⠀⠀
//⣿⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣹⣦⣤⣤⣤⡄⠀⠀⢀⠙⢦⣄⡀⠀⠀⣀⣴⣟⢸⡇⠀⠀⠀⠀⢿⠀⠈⢷⣄⠀⠀⠀⠀
//⢿⡀⠀⠀⣷⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠟⠛⠋⠉⠉⠛⠛⢾⡟⠁⠀⠈⠉⠛⠋⠉⠀⠙⢿⡇⠀⠀⠀⠀⢸⡇⠀⠀⠉⠳⠶⣤⡀
//⠘⢷⣀⣤⠘⢷⣄⡀⠀⠀⠀⠀⢠⡿⠁⠀⠀⠀⠀⠀⠀⠀⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣠⡾⠁
//⠀⠈⠛⠿⣦⡀⠈⣿⣶⣤⣀⠀⠈⠓⠦⣀⠀⠀⠀⠀⠀⠀⢰⡇⠀⠀⠀⠀⠀⠀⠀⠀⣰⠞⠁⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⣿⠀⠀
//⠀⠀⠀⠀⠙⠻⠿⣿⣿⣟⣻⣶⣦⣤⣀⡉⠑⠒⠦⠤⠴⠟⠀⠀⠀⠀⠀⠀⠀⠀⣴⣏⠀⠀⠀⠀⠀⠀⢸⡇⣿⣄⠀⢀⡏⠀⠀
//⠀⠀⠀⠀⠀⣰⢿⣟⡙⣛⣿⣿⣿⢟⣿⣿⠶⣶⣦⣤⣤⣀⣀⠀⠀⠀⠀⢀⣾⡿⠋⠀⠀⠀⠀⠀⠀⣾⣿⣟⣿⢀⡾⠃⠀⠀
//⠀⠀⠀⠀⢠⡾⠃⣼⠈⢿⣿⣯⣡⣾⡿⢻⡿⠀⢺⡟⠻⢿⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀⢀⣾⣿⠿⠛⣿⣫⣥⣤⠀⠀
//⠀⠀⢰⡟⢷⣯⣤⣴⡇⠀⠀⠈⠉⠉⠁⣴⣿⡁⢠⣾⡷⣶⣶⠻⢿⣦⣄⡉⠓⠶⠤⠴⢶⡾⠃⢀⣠⣾⣿⣷⣾⣿⣛⣉⣉⣿⠀⠀
int n,x,a,b,c;
vector<pair<int,string>> v;
vector<string> s[100];
int cal()
{
x=(x*a+b)%c;
return x;
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
cin>>n>>x>>a>>b>>c;
for(int i=0;i<n;i++)
{
string s;
int k;
cin>>s>>k;
v.push_back({-k,s});
}
sort(v.begin(),v.end());
for(int i=0;i<n;i++)
s[i/(n/4)].push_back(v[i].second);
for(int i=0;i<n/4;i++)
{
cout<<"Group "<<(char)('A'+i)<<":"<<endl;
for(int j=0;j<4;j++)
{
int p=cal()%(int)s[j].size();
cout<<s[j][p]<<endl;
s[j].erase(s[j].begin()+p);
}
}
return 0;
}