Submission #17644

# Submission time Handle Problem Language Result Execution time Memory
17644 2016-01-06T08:57:34 Z Namnamseo 개미 (GA4_ant) C++14
100 / 100
70 ms 1084 KB
#include <cstdio>

typedef long long ll;

ll min(ll a,ll b){ return a>b?b:a; }
ll min(ll a,ll b,ll c){ return min(min(a,b),c);}

void swap(int&a,int&b){ll tmp=a; a=b; b=tmp; }
 
int main(){
  int tc;
  scanf("%d",&tc);
  int a,b,c;
  for(;tc--;){
    scanf("%d%d%d",&a,&b,&c);
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(a>b) swap(a,b);
    if(b==0) printf("%lld\n",c*1ll*c);
    else if(a==0) printf("%lld\n",c*1ll*c+b*1ll*b);
    else printf("%lld\n",a*1ll*a+b*1ll*b+c*1ll*c+min(a*2ll*b,b*2ll*c,c*2ll*a));
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 1084 KB Output is correct
2 Correct 48 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1084 KB Output is correct
2 Correct 52 ms 1084 KB Output is correct
3 Correct 48 ms 1084 KB Output is correct
4 Correct 70 ms 1084 KB Output is correct
5 Correct 38 ms 1084 KB Output is correct