QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#270011 | #7750. Revenge on My Boss | Hayasa | WA | 25ms | 4572kb | C++20 | 892b | 2023-11-30 13:43:32 | 2023-11-30 13:43:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
struct node{
int a,b,c,id;
bool operator <(const node &_)const{
if(a<b&&_.a<_.b){
if(c!=_.c) return c<_.c;
return b-a<_.b-_.a;
}
if(a<b&&_.a>=_.b)return 1;
if(a>b&&_.a<=_.b)return 0;
if(a>b&&_.a>_.b){
if(c!=_.c)return c>_.c;
return a-b>_.a-_.b;
}
if(a==b&&_.a>_.b)return 1;
if(a==b&&_.a<_.b)return 0;
return 0;
}
};
vector<node>P(n);
int ans;
int sa=0,sb=0;
for(int i=0;i<n;++i){
int a,b,c;
cin>>a>>b>>c;
P[i]={a,b,c,i};
sb+=b;
}
sort(P.begin(),P.end());
for(int i=0;i<n;++i)cout<<P[i].id+1<<" ";
cout<<"\n";
// for(int i=0;i<n;++i){
// sa+=P[i].a;
// if(i==0||ans<(sa+sb)*P[i].c)
// ans=(sa+sb)*P[i].c;
// sb-=P[i].b;
// }
// cout<<ans<<"\n";
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int T;
cin>>T;
while(T--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3400kb
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 4 8 2 5 9 7 1 6
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 25ms
memory: 4572kb
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:
3279 33159 42649 83648 6744 27176 76651 39241 38363 4279 43470 32094 22916 93150 70262 94502 39309 17982 46457 30921 26242 83359 2457 10029 46579 83071 74378 45782 63199 67385 76738 93580 82908 7471 29313 77895 95574 28935 69647 5397 76850 91426 41763 74616 20240 1881 77030 81217 56243 30479 63986 3...
result:
wrong answer Wrong Answer on Case#1