Submission #34350023


Source Code Expand

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

ll a, b, c;

int main()
{
  cin >> a >> b >> c;
  if (a > b) swap(a, b);
  if (b > c) swap(b, c);
  if (a > b) swap(a, b);

  ll ans = b - a;
  c -= b - a;
  b = a;

  if (c - b > a) {
    cout << -1;
    return 0;
  }

  ans += c;
  cout << ans;



  return 0;
}

Submission Info

Submission Time
Task A - Three Integers
User atatomir
Language C++ (GCC 9.2.1)
Score 300
Code Size 502 Byte
Status AC
Exec Time 6 ms
Memory 3632 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 16
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, sample01.txt, sample02.txt, sample03.txt
Case Name Status Exec Time Memory
in01.txt AC 6 ms 3512 KiB
in02.txt AC 2 ms 3564 KiB
in03.txt AC 3 ms 3372 KiB
in04.txt AC 2 ms 3420 KiB
in05.txt AC 3 ms 3420 KiB
in06.txt AC 3 ms 3564 KiB
in07.txt AC 2 ms 3512 KiB
in08.txt AC 2 ms 3388 KiB
in09.txt AC 3 ms 3600 KiB
in10.txt AC 2 ms 3540 KiB
in11.txt AC 2 ms 3368 KiB
in12.txt AC 2 ms 3424 KiB
in13.txt AC 2 ms 3424 KiB
sample01.txt AC 2 ms 3432 KiB
sample02.txt AC 2 ms 3632 KiB
sample03.txt AC 4 ms 3536 KiB