QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55444 | #2960. Social Distancing | MahmoudAtia# | AC ✓ | 3ms | 3752kb | C++ | 984b | 2022-10-13 19:32:48 | 2022-10-13 19:32:50 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, -1, 0, 1, -1, 1};
int dj[] = {1, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18, MOD = 998244353;
const int N = 1e4 + 5, M = 350;
const ld PI = acos(-1.0), EPS = 1e-9;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int t, n, m, k, f, a[N];
//#define endl '\n'
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//freopen("farm.in", "r", stdin);
//memset(dp, -1, sizeof dp);
cin >> n >> m;
for (int i = 0; i < m; i++) cin >> a[i];
a[m] = a[0] + n;
int ans = 0;
if (m == 1) cout << (n - 2) / 2;
else {
for (int i = 1; i <= m; i++) ans += (a[i] - a[i - 1] - 2) / 2;
cout << ans;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3604kb
input:
9 2 2 6
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3464kb
input:
10 3 1 4 7
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3672kb
input:
6 2 2 5
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
100 5 7 14 47 78 99
output:
43
result:
ok single line: '43'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
6 1 3
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
3 1 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3464kb
input:
4 2 1 3
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
4 2 2 4
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
5 2 1 3
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
5 2 2 4
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
5 2 3 5
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
5 2 1 4
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
5 2 2 5
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3588kb
input:
7 1 1
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
1000 1 1
output:
499
result:
ok single line: '499'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
1000 1 2
output:
499
result:
ok single line: '499'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
1000 1 1000
output:
499
result:
ok single line: '499'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
1000 1 999
output:
499
result:
ok single line: '499'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3536kb
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: 2ms
memory: 3644kb
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: 2ms
memory: 3588kb
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: 2ms
memory: 3664kb
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: 2ms
memory: 3616kb
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: 2ms
memory: 3752kb
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: 2ms
memory: 3600kb
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: 0ms
memory: 3584kb
input:
100 3 9 12 24
output:
46
result:
ok single line: '46'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3528kb
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: 2ms
memory: 3660kb
input:
1000 5 379 544 574 769 776
output:
493
result:
ok single line: '493'
Test #29:
score: 0
Accepted
time: 2ms
memory: 3704kb
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: 2ms
memory: 3748kb
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: 2ms
memory: 3680kb
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: 2ms
memory: 3472kb
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'