Jump and Jump...
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 250 Accepted Submission(s): 177
2 3 10 10 10 10 20 30 10 10 20 2 3 4 1 1 2 1
3 1 2 1 2HintFor the first case, the farthest distance each kid can jump is 10, 30 and 20. So the rank is 3, 1, 2.
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#include <stack>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
struct node
{
int id;
int v;
int t;
}nod[10];
bool cmp(node a,node b){
return a.v>b.v;
}
int t,n;
int a,b,c;
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
cin>>t;
while(t--)
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a>>b>>c;
nod[i].v=max(a,max(b,c));
nod[i].id=i;
}
sort(nod+1,nod+1+n,cmp);
for(int i=1;i<=n;i++)
{
nod[nod[i].id].t=i;
}
for(int i=1;i<n;i++)
{
cout<<nod[i].t<<" ";
}
cout<<nod[n].t<<endl;
}
return 0;
}最近才用到离散化,这个题目有点那个意思