6 条题解

  • 0
    @ 2024-3-17 18:29:57
    #include<stdio.h>
    #include<string.h>
    #include<queue>
    #include<math.h>
    #include<vector>
    #include<algorithm>
    #include<iomanip>
    #include<stack>
    #define LL long long
    using namespace std;
    const int INF=0x3f3f3f3f;
    const int N=2e5+10;
    struct stt
    {
    	int id;
    	int yw;
    	int sx;
    	int yy;
    	int zf;
    }a[N];
    
    int n,k;
    bool cmp(stt a1,stt a2){
    	if(a1.zf==a2.zf){
    		if(a1.yw==a2.yw){
    			if(a1.sx==a2.sx){
    				if(a1.yy==a2.yy)
    					return a1.id<a2.id;
    				return a1.yy>a2.yy;
    			}
    			return a1.sx>a2.sx;
    		}
    		return a1.yw>a2.yw;
    	}
    	return a1.zf>a2.zf;
    }
    int main(){
    	cin>>n>>k;
    	for(int i=1;i<=n;i++){
    		cin>>a[i].id>>a[i].yw>>a[i].sx>>a[i].yy;
    		a[i].zf=a[i].yw+a[i].sx+a[i].yy;
    	}
    	sort(a+1,a+n+1,cmp);
    	cout<<a[k].id<<" "<<a[k].yw<<" "<<a[k].sx<<" "<<a[k].yy<<" "<<a[k].zf;
    	return 0;
    } 
    

    信息

    ID
    1363
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    598
    已通过
    182
    上传者