QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#268899 | #7750. Revenge on My Boss | ucup-team134# | WA | 26ms | 4988kb | C++14 | 802b | 2023-11-28 23:54:58 | 2023-11-28 23:55:00 |
Judging History
answer
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define pb push_back
const int N=100050;
int a[N],b[N],c[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];
}
}
int main(){
int t;
scanf("%i",&t);
while(t--){
int n;
scanf("%i",&n);
vector<int> ord;
for(int i=1;i<=n;i++){
scanf("%i %i %i",&a[i],&b[i],&c[i]);
ord.pb(i);
}
sort(ord.begin(),ord.end(),cmp);
for(int i:ord)printf("%i ",i);
printf("\n");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
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 4 2 5 9 7 1 6
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 26ms
memory: 4988kb
input:
1 100000 581297 102863 1 742857 42686 1 676710 233271 1 443055 491162 1 442056 28240 1 769277 331752 1 8608 369730 1 495112 525554 1 787449 938154 1 441186 850694 1 84267 925450 1 740811 32385 1 834021 37680 1 257878 564126 1 90618 914340 1 239641 463103 1 40687 343062 1 587737 458554 1 103684 48666...
output:
77582 77581 82112 72163 18220 43645 30468 80107 54173 17444 14872 8630 50133 26305 35 70096 40298 10072 56385 75312 79444 19284 81622 95793 96892 82320 8443 11434 56765 72103 89089 86041 48305 32033 88191 83243 9383 66880 81866 31386 23642 79775 66240 99937 38682 18931 39524 48449 36540 202 11001 62...
result:
wrong answer Wrong Answer on Case#1