Another Sorting Problem

#include<bits/stdc++.h>
using namespace std;
struct stu{
    string s;
    int num;
}a[1000005];
int cmp(stu a,stu b){
    return a.s<b.s; 
}
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
        cin>>a[i].s;
        a[i].num=i;
        for(int j=1;j<m;j+=2){
            a[i].s[j] = 'Z' - a[i].s[j] + 'A';
        }
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++){
        cout<<a[i].num<<" ";
    }
    return 0;
} 

 

上一篇:1067 Problem A


下一篇:题解 CF1624F【Interacdive Problem】