Submission #39671736


Source Code Expand

#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<memory>
#include<time.h>
#include<math.h>
#include<bitset>
#include<fstream>
#include<sstream>
#include<stdio.h>
#include<utility>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t;
    scanf("%d",&t);
    int zu;
    for (zu=0;zu<t;zu++)
    {
        int a,b,c;
        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);
        }
        int x = b - a;
        int y = c - b;
        if ((x % 2 == 1) || (y % 2 == 1))
        {
            puts("-1");
            continue;
        }
        x/=2;
        y/=2;
        if ((x - y) % 3 != 0)
        {
            puts("-1");
            continue;
        }
        printf("%d\n",min(x,y) + (max(x,y) - min(x,y)) / 3 * 2);
    } 
    return 0;
}

Submission Info

Submission Time
Task A - +3 +5 +7
User Kroos_kokodayo
Language C++ (GCC 9.2.1)
Score 300
Code Size 1207 Byte
Status AC
Exec Time 87 ms
Memory 3720 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   28 |     scanf("%d",&t);
      |     ~~~~~^~~~~~~~~
./Main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   33 |         scanf("%d%d%d",&a,&b,&c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 7
Set Name Test Cases
Sample 01_sample_01.txt
All 01_sample_01.txt, 02_test_a_01.txt, 02_test_a_02.txt, 03_test_b_01.txt, 03_test_b_02.txt, 04_test_c_01.txt, 04_test_c_02.txt
Case Name Status Exec Time Memory
01_sample_01.txt AC 7 ms 3608 KiB
02_test_a_01.txt AC 84 ms 3716 KiB
02_test_a_02.txt AC 81 ms 3716 KiB
03_test_b_01.txt AC 75 ms 3720 KiB
03_test_b_02.txt AC 75 ms 3636 KiB
04_test_c_01.txt AC 84 ms 3508 KiB
04_test_c_02.txt AC 87 ms 3708 KiB