QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#714745#5678. Busy As a Beezeyu#AC ✓2ms3700kbC++231.9kb2024-11-06 04:37:052024-11-06 04:37:05

Judging History

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

  • [2024-11-06 04:37:05]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3700kb
  • [2024-11-06 04:37:05]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;

#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif

const ll mod = 1e9 + 7;

template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll m, n; cin >> m >> n;
	ll totedge = 6 * m - (m - 1), numgrid = m;
	for (int i = 1; i < n; i ++){
		if (i & 1){
			totedge += 4 * (m - 1) - (m - 2);
			numgrid += m - 1;
		} else{
			totedge += 4 * m - (m - 1) + 2;
			numgrid += m;
		}
	}
	cout << totedge - (numgrid + 1) / 2 + 1; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3636kb

input:

2 1

output:

11

result:

ok single line: '11'

Test #2:

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

input:

3 3

output:

32

result:

ok single line: '32'

Test #3:

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

input:

2 2

output:

14

result:

ok single line: '14'

Test #4:

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

input:

1000000 1000000

output:

2500002749999

result:

ok single line: '2500002749999'

Test #5:

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

input:

2 1000000

output:

5750003

result:

ok single line: '5750003'

Test #6:

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

input:

1000000 1

output:

4500002

result:

ok single line: '4500002'

Test #7:

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

input:

64 64

output:

10415

result:

ok single line: '10415'

Test #8:

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

input:

2 64

output:

371

result:

ok single line: '371'

Test #9:

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

input:

64 2

output:

448

result:

ok single line: '448'

Test #10:

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

input:

3 3

output:

32

result:

ok single line: '32'

Test #11:

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

input:

100 50

output:

12736

result:

ok single line: '12736'

Test #12:

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

input:

50000 25000

output:

3125118749

result:

ok single line: '3125118749'

Test #13:

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

input:

25000 50000

output:

3125087499

result:

ok single line: '3125087499'

Test #14:

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

input:

2017 2023

output:

10206530

result:

ok single line: '10206530'

Test #15:

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

input:

2 2023

output:

11637

result:

ok single line: '11637'

Test #16:

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

input:

2023 1

output:

9105

result:

ok single line: '9105'

Test #17:

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

input:

2023 101

output:

514930

result:

ok single line: '514930'

Test #18:

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

input:

12348 5554

output:

171480840

result:

ok single line: '171480840'