QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#131052#2960. Social Distancingl1924365846WA 1ms4652kbC++142.1kb2023-07-26 09:04:112023-07-26 09:04:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-26 09:04:13]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4652kb
  • [2023-07-26 09:04:11]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <set>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define int ll
#define ms(a,b) memset((a),(b),sizeof(a))
#define mc(a,b) memcpy((a),(b),sizeof(a))
#define PI acos(-1)
#define ssin(x) sin(x*PI/180.00)
#define ccos(x) cos(x*PI/180.00)
#define ttan(X) tan(x*PI/180.00)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, n, a) for (int i = n - 1; i >= a; i--)
#define IOS ios::sync_with_stdio(false)
#define si(x) scanf("%d",&x)
#define sii(x, y) scanf("%d %d",&x, &y)
#define siii(x, y, z) scanf("%d %d %d",&x, &y, &z)
#define siiii(x, y, z, w) scanf("%d %d %d %d",&x, &y, &z, &w)
#define sl(x) scanf("%lld",&x)
#define sll(x, y) scanf("%lld %lld",&x, &y)
#define slll(x, y, z) scanf("%lld %lld %lld",&x, &y, &z)
#define sllll(x, y, z, w) scanf("%lld %lld %lld %lld",&x, &y, &z, &w)
#define pr(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define sd(x) scanf("%lf",&x)
#define sdd(x, y) scanf("%lf %lf",&x, &y)
#define sddd(x, y, z) scanf("%lf %lf %lf",&x, &y, &z)
#define sdddd(x, y, z, w) scanf("%lf %lf %lf %lf",&x, &y, &z, &w)
#define x first
#define y second
#define pb push_back
#define mk make_mair

using namespace std;

typedef unsigned long long ull;

typedef pair<int, int> PII;

const int mod = 998244353;

const int P = 131;

const int N = 1e5 + 10, M = 2e6 + 10;

const int inf = 0x3f3f3f3f;

const ll lnf = 9e18;

const double eps = 1e-6;

void solve() {
	int s, n, res = 0;
	int a[N];
	sll (s, n);

	for (int i = 0; i < n; i ++) {
		sl (a[i]);
	}

	sort (a, a + n);
	res += (a[0] - 1) / 2;
	int l = a[0];

	for (int i = 1; i < n; i ++) {
		res += (a[i] - l - 2) / 2;
		l = a[i];
	}

	if (a[0] % 2) {
		res += (s - l) / 2;
	}
	else {
		res += (s - l - 1) / 2;
	}

	printf ("%lld\n", res);
}

signed main() {
	int T (1);
//	IOS;
//	cin.tie (0);
//	cout.tie (0);
//	cin >> T;
//	sl (T);

	while ( T-- ) {
		solve();
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4508kb

input:

9 2
2 6

output:

2

result:

ok single line: '2'

Test #2:

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

input:

10 3
1 4 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

6 2
2 5

output:

0

result:

ok single line: '0'

Test #4:

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

input:

100 5
7 14 47 78 99

output:

43

result:

ok single line: '43'

Test #5:

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

input:

6 1
3

output:

2

result:

ok single line: '2'

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 4652kb

input:

3 1
1

output:

1

result:

wrong answer 1st lines differ - expected: '0', found: '1'