QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#62133#4541. Black Magicqinjianbin#AC ✓4ms3560kbC++17572b2022-11-17 15:08:432022-11-17 15:08:44

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-11-17 15:08:44]
  • Judged
  • Verdict: AC
  • Time: 4ms
  • Memory: 3560kb
  • [2022-11-17 15:08:43]
  • Submitted

answer

#include<bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define _for(i, a, b) for(int i = (a); i <= (b); i++)
using namespace std;

int main()
{
	int T; scanf("%d", &T);
	while(T--)
	{
		 int E, L, R, B, sum;;
		 scanf("%d%d%d%d", &E, &L, &R, &B);
		 sum = E + L + R + B;

		 if(B)
		 {
			int ans = B - 1;
			if(L) ans++, L--;
			if(R) ans++, R--;
			ans += min(L, R);
			printf("%d ", sum - ans);
		 }
		 else printf("%d ", sum - min(L, R));

		 int t = max(0, B - (E + 1));
		 printf("%d\n", sum - t);
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 3560kb

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