QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#131059 | #2960. Social Distancing | l1924365846 | AC ✓ | 1ms | 4664kb | C++14 | 2.2kb | 2023-07-26 09:08:55 | 2023-07-26 09:08:55 |
Judging History
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 - 1) / 2;
}
else {
res += (s - l) / 2;
}
if (a[0] % 2 && a[n - 1] == s)
res--;
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4420kb
input:
9 2 2 6
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4480kb
input:
10 3 1 4 7
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 4508kb
input:
6 2 2 5
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 4440kb
input:
100 5 7 14 47 78 99
output:
43
result:
ok single line: '43'
Test #5:
score: 0
Accepted
time: 1ms
memory: 4520kb
input:
6 1 3
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 1ms
memory: 4396kb
input:
3 1 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 4660kb
input:
4 2 1 3
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 1ms
memory: 4388kb
input:
4 2 2 4
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 1ms
memory: 4412kb
input:
5 2 1 3
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 0ms
memory: 4368kb
input:
5 2 2 4
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 4424kb
input:
5 2 3 5
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 1ms
memory: 4616kb
input:
5 2 1 4
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 4660kb
input:
5 2 2 5
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4440kb
input:
7 1 1
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 1ms
memory: 4652kb
input:
1000 1 1
output:
499
result:
ok single line: '499'
Test #16:
score: 0
Accepted
time: 1ms
memory: 4664kb
input:
1000 1 2
output:
499
result:
ok single line: '499'
Test #17:
score: 0
Accepted
time: 1ms
memory: 4380kb
input:
1000 1 1000
output:
499
result:
ok single line: '499'
Test #18:
score: 0
Accepted
time: 1ms
memory: 4664kb
input:
1000 1 999
output:
499
result:
ok single line: '499'
Test #19:
score: 0
Accepted
time: 1ms
memory: 4516kb
input:
1000 500 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 17...
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 1ms
memory: 4436kb
input:
1000 500 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 ...
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 1ms
memory: 4524kb
input:
999 499 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173...
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 1ms
memory: 4484kb
input:
999 499 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 1...
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 1ms
memory: 4440kb
input:
999 498 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173...
output:
1
result:
ok single line: '1'
Test #24:
score: 0
Accepted
time: 0ms
memory: 4440kb
input:
999 333 2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 185 188 191 194 197 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 ...
output:
0
result:
ok single line: '0'
Test #25:
score: 0
Accepted
time: 1ms
memory: 4420kb
input:
1000 250 3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63 67 71 75 79 83 87 91 95 99 103 107 111 115 119 123 127 131 135 139 143 147 151 155 159 163 167 171 175 179 183 187 191 195 199 203 207 211 215 219 223 227 231 235 239 243 247 251 255 259 263 267 271 275 279 283 287 291 295 299 303 307 311 315 31...
output:
250
result:
ok single line: '250'
Test #26:
score: 0
Accepted
time: 1ms
memory: 4648kb
input:
100 3 9 12 24
output:
46
result:
ok single line: '46'
Test #27:
score: 0
Accepted
time: 1ms
memory: 4420kb
input:
100 10 19 21 27 33 57 71 74 80 86 99
output:
39
result:
ok single line: '39'
Test #28:
score: 0
Accepted
time: 1ms
memory: 4652kb
input:
1000 5 379 544 574 769 776
output:
493
result:
ok single line: '493'
Test #29:
score: 0
Accepted
time: 1ms
memory: 4436kb
input:
1000 100 9 32 34 49 66 73 75 96 99 102 108 110 112 115 118 120 128 134 149 161 168 192 194 219 230 246 250 276 293 304 306 330 333 343 358 369 375 381 404 418 421 428 434 454 457 462 465 497 499 502 514 516 518 532 536 539 549 552 556 562 570 581 584 590 618 653 663 666 668 709 712 726 730 749 757 7...
output:
377
result:
ok single line: '377'
Test #30:
score: 0
Accepted
time: 1ms
memory: 4416kb
input:
1000 200 3 14 18 20 26 31 37 41 47 51 55 59 63 67 73 75 80 85 88 91 94 98 105 110 114 116 123 129 131 134 143 147 150 157 161 163 167 173 176 178 187 190 192 194 200 210 217 220 228 232 238 241 248 250 252 267 272 277 281 285 292 296 302 310 315 319 323 331 337 341 345 350 354 358 361 368 374 378 38...
output:
256
result:
ok single line: '256'
Test #31:
score: 0
Accepted
time: 1ms
memory: 4664kb
input:
1000 333 2 6 10 13 15 17 20 22 25 27 29 33 35 38 42 45 47 49 51 55 58 60 62 65 67 69 73 75 80 82 86 93 95 97 102 106 108 111 113 116 121 124 126 135 138 144 146 151 154 157 161 166 168 171 173 175 178 181 183 186 188 190 192 195 199 201 205 208 212 214 220 222 225 227 229 231 233 235 238 240 242 245...
output:
104
result:
ok single line: '104'
Test #32:
score: 0
Accepted
time: 0ms
memory: 4504kb
input:
1000 400 2 4 6 9 11 14 16 18 20 22 25 30 33 36 39 42 45 47 49 51 54 56 59 61 63 65 68 70 72 75 78 81 85 87 89 91 93 95 98 101 103 105 108 110 112 114 117 119 122 125 127 130 135 137 140 142 145 147 150 152 154 157 161 163 165 167 169 171 173 176 178 180 183 186 188 191 193 196 198 202 204 207 210 21...
output:
27
result:
ok single line: '27'