QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#49516#4541. Black MagicCDsmen#AC ✓3ms3724kbC++883b2022-09-21 20:00:112022-09-21 20:00:12

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-21 20:00:12]
  • Judged
  • Verdict: AC
  • Time: 3ms
  • Memory: 3724kb
  • [2022-09-21 20:00:11]
  • Submitted

answer

#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long llint;

inline int read()
{
    int ans = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        ans = ans * 10 + ch - '0';
        ch = getchar();
    }
    return ans * w;
}

inline void solve()
{
    int a = read(), b = read(), c = read(), d = read();
    int n = a + b + c + d;
    int tmp = d - a;

    printf("%d %d\n", n-min(b,c)-(max(b,c)!=0?d:(d==0?0:d-1)), n - max(0, tmp - 1));
}

int main()
{
    // IO;
    //  init();
    int tt = 1;
    tt = read();
    //   scanf("%d", &tt);
    while (tt--)
    {
        solve();
        // cout << tt << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3724kb

input:

4000
0 0 0 1
0 0 0 100000
0 0 0 11
0 0 0 12
0 0 0 13
0 0 0 2
0 0 0 25
0 0 0 3
0 0 0 4
0 0 0 5
0 0 0 6
0 0 0 7
0 0 0 8
0 0 0 9
0 0 1 0
0 0 1 1
0 0 1 12
0 0 1 14
0 0 1 17
0 0 1 2
0 0 1 21
0 0 1 3
0 0 1 4
0 0 1 5
0 0 1 6
0 0 1 7
0 0 1 8
0 0 1 9
0 0 100000 0
0 0 11 6
0 0 12 3
0 0 12 4
0 0 13 0
0 0 13 12...

output:

1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
100000 100000
11 12
12 13
12 13
13 13
13 14
13 14
14 15
16 16
16 17
16 17
2 2
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
26 27
3 3
3 4
3 4
3 4
3 4
3 4
3 4
3 4
3 4
3 4
3 4
3 4
4 4
4 5
...

result:

ok 4000 lines