Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define gc c=getchar()
- #define r(x) read(x)
- #define ll long long
- template<typename T>
- inline void read(T&x){
- x=0;T k=1;char gc;
- while(!isdigit(c)){if(c=='-')k=-1;gc;}
- while(isdigit(c)){x=x*10+c-'0';gc;}x*=k;
- }
- int cnt[10];
- int pointer[10];
- int a[10][10];
- vector<int>tmp;
- int main(){
- // freopen(".in","r",stdin);
- // freopen(".out","w",stdout);
- int n;r(n);
- for(int i=0;i<n;++i){
- r(cnt[i]);
- for(int j=0;j<cnt[i];++j){
- r(a[i][j]);
- tmp.push_back(a[i][j]);
- }
- }
- sort(tmp.begin(),tmp.end());
- for(int i=0;i<tmp.size();++i){
- for(int j=0;j<n;++j){
- if(a[j][pointer[j]]==tmp[i]){
- ++pointer[j];
- putchar('A'+j);
- break;
- }
- }
- }
- puts("");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment