60pts求助 #1 #2 WA其他AC
查看原帖
60pts求助 #1 #2 WA其他AC
320697
AMIRIOX無暝楼主2020/5/11 21:15

洛谷混了三个月,连个黄题都做不出来了

#1 #2 WA,其他点AC,不知道为啥

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;

int n,m;
struct t
{
    int ind;
    string val;
    bool operator<(const t& b) const{
        return val < b.val;
    }
    bool operator>(const t& b) const{
        return val > b.val;
    }
}nu[100001];
int main(){
    //int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        nu[i].ind=i+1;
        nu[i].val.resize(1000);
        scanf("%s",&nu[i].val[0]);
    }
    sort(nu,nu+n);
    //printf("%d\n%d",nu[n-2].ind,nu[n-2].val);
    // for(int i=0;i<n;i++){
    //     printf("%lld %lld\n",nu[i].ind,nu[i].val);
    // }
    printf("%d\n%s",nu[n-1].ind,nu[n-1].val.c_str());
    //system("pause");
    return 0;
}
2020/5/11 21:15
加载中...