QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112186#5678. Busy As a BeePetroTarnavskyi#AC ✓3ms3556kbC++17843b2023-06-10 15:16:152023-06-10 15:16:18

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-10 15:16:18]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3556kb
  • [2023-06-10 15:16:15]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	LL n, m;
	cin >> m >> n;
	LL total = n / 2 * (4 * m + m + m + 1);
	if (n % 2 == 0)
		total += 2 * m - 2;
	else
		total += 4 * m + m + 1;
	LL cnt = (n + 1) / 2 * m + n / 2 * (m - 1);
	cout << total - (cnt + 1) / 2 + 1 << '\n';
	
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3324kb

input:

2 1

output:

11

result:

ok single line: '11'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

3 3

output:

32

result:

ok single line: '32'

Test #3:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

2 2

output:

14

result:

ok single line: '14'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

1000000 1000000

output:

2500002749999

result:

ok single line: '2500002749999'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3340kb

input:

2 1000000

output:

5750003

result:

ok single line: '5750003'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

1000000 1

output:

4500002

result:

ok single line: '4500002'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

64 64

output:

10415

result:

ok single line: '10415'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

2 64

output:

371

result:

ok single line: '371'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3468kb

input:

64 2

output:

448

result:

ok single line: '448'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

3 3

output:

32

result:

ok single line: '32'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

100 50

output:

12736

result:

ok single line: '12736'

Test #12:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

50000 25000

output:

3125118749

result:

ok single line: '3125118749'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

25000 50000

output:

3125087499

result:

ok single line: '3125087499'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3464kb

input:

2017 2023

output:

10206530

result:

ok single line: '10206530'

Test #15:

score: 0
Accepted
time: 2ms
memory: 3328kb

input:

2 2023

output:

11637

result:

ok single line: '11637'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

2023 1

output:

9105

result:

ok single line: '9105'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3372kb

input:

2023 101

output:

514930

result:

ok single line: '514930'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

12348 5554

output:

171480840

result:

ok single line: '171480840'