1 solutions

  • 1
    @ 2025-1-17 16:12:11

    话说小X真是好烦啊,天天有那么多问题~
    呵呵呵呵
    嘻嘻嘻嘻
    哈哈哈哈
    小X就是XXS

    #include <bits/stdc++.h>
    using namespace std;
    int n,a[100001],c = 0,t;
    map<int,int,greater<int> > mp;
    int main(){
    	scanf("%d",&n);
    	for(int i = 1;i<=n;i++){
    		scanf("%d",&a[i]);
    		if(!mp.count(a[i]))mp[a[i]] = 1;
    		else mp[a[i]]++;
    	}
    	map<int,int>::iterator it;
    	for(it = mp.begin();it != mp.end();it++){
    		t = it->second;
    		mp[it->first] = c+1;
    		c+=t;
    	}
    	for(int i = 1;i<=n;i++)printf("%d\n",mp[a[i]]);
    	return 0;
    }
    
    • 1

    Information

    ID
    694
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    9
    Tags
    (None)
    # Submissions
    13
    Accepted
    4
    Uploaded By