QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#268906 | #7750. Revenge on My Boss | ucup-team134# | WA | 1ms | 3608kb | C++14 | 1.2kb | 2023-11-29 00:07:24 | 2023-11-29 00:07:25 |
Judging History
answer
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define pb push_back
#define ll long long
const int N=100050;
int a[N],b[N],c[N],d[N];
/*int Get(int i){
if(a[i]<b[i])return 0;
if(a[i]==b[i])return 1;
return 2;
}
bool cmp(int i,int j){
if(Get(i)!=Get(j))return Get(i)<Get(j);
if(Get(i)==0){
if(c[i]!=c[j])return c[i]<c[j];
return b[i]-a[i]>b[j]-a[j];
}else if(Get(i)==1){
return false;
}else{
if(c[i]!=c[j])return c[i]>c[j];
return a[i]-b[i]<a[j]-b[j];
}
}*/
bool cmp2(int i,int j){
return (ll)d[j]*c[i]<(ll)d[i]*c[j];
}
int main(){
int t;
scanf("%i",&t);
while(t--){
int n;
scanf("%i",&n);
vector<int> ans,L,R;
for(int i=1;i<=n;i++){
scanf("%i %i %i",&a[i],&b[i],&c[i]);
d[i]=abs(a[i]-b[i]);
if(a[i]<b[i])L.pb(i);
if(a[i]>b[i])R.pb(i);
}
sort(L.begin(),L.end(),cmp2);
sort(R.rbegin(),R.rend(),cmp2);
for(int i:L)ans.pb(i);
for(int i=1;i<=n;i++){
if(d[i]==0)ans.pb(i);
}
for(int i:R)ans.pb(i);
for(int i:ans)printf("%i ",i);
printf("\n");
/*printf(" ");
for(int i=1;i<n;i++){
if(!cmp2(ans[i-1],ans[i])){
printf("=");
}else{
printf("<");
}
printf(" ");
}
printf("\n");*/
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3608kb
input:
2 4 1 1 4 5 1 5 1 9 1 9 8 1 9 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 8 3 2 7
output:
3 1 2 4 3 8 2 4 9 5 6 1 7
result:
wrong answer Wrong Answer on Case#2