QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260746 | #7758. Painter | Loging# | WA | 1ms | 3536kb | C++20 | 1.0kb | 2023-11-22 14:42:18 | 2023-11-22 14:42:18 |
Judging History
answer
#include <bits/stdc++.h>
#define Max 100005
using namespace std;
struct Node{
int a,b,c,d,id;
inline bool operator<(const Node x)const{
if(d!=x.d)return d<x.d;
int sum1=max(1ll*c*(a+b)+1ll*c*x.b,1ll*x.c*(x.a+x.b)+1ll*x.c*a);
int sum2=max(1ll*x.c*(x.a+x.b)+1ll*x.c+b,1ll*c*(a+b)+1ll*c*x.a);
return sum1<sum2;
}
}p[Max],q[Max];
int T,n,id[Max];
int main(){
ios::sync_with_stdio(false);
cin>>T;
while(T--){
cin>>n;
for(int i=1;i<=n;i++){
p[i].id=i;
cin>>p[i].a>>p[i].b>>p[i].c;
if(p[i].a<p[i].b)p[i].d=-1;
else if(p[i].a==p[i].b)p[i].d=0;
else p[i].d=1;
}
// for(int i=1;i<=n;i++)cin>>id[i];
// for(int i=1;i<=n;i++){
// q[i]=p[id[i]];
// }
// for(int i=1;i<=n;i++)p[i]=q[i];
sort(p+1,p+n+1);
for(int i=1;i<=n;i++)cout<<p[i].id<<" ";cout<<'\n';
int ans=0;
for(int i=1;i<=n;i++){
int sum=0;
for(int j=1;j<=i;j++)sum+=p[j].a;
for(int j=i;j<=n;j++)sum+=p[j].b;
ans=max(ans,sum*p[i].c);
}
cout<<ans<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
7 Circle 0 0 5 * Circle -2 2 1 @ Circle 2 2 1 @ Rectangle 0 -1 0 0 ^ Rectangle -2 -2 2 -2 _ Render -5 -5 5 5 Render -1 0 1 2
output:
0 0 0 0 0 0 0
result:
wrong answer 1st lines differ - expected: '.....*.....', found: ''