UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212868#3819. Ahappywinter501798ms4288kbC++11519b2024-10-20 15:35:112024-10-20 18:48:41

answer

# include <iostream>
# include <cstdio>
# include <cmath>
# include <algorithm>
# include <cstring>
# include <vector>
# include <map>
# include <ctime>
# include <unordered_map>
# include <queue>
# define imp {return puts("No"), 0;}
using namespace std;
const int MAXN = 4e5 + 10;
int n, p[MAXN], id[MAXN];
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> p[i], id[p[i]] = i;
	for (int i = 1; i < n; i++) {
		if (abs(p[i - 1] - p[i]) > 2) {
			imp;
		}
	}
	puts("Yes");
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

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

input:

95
47 46 70 45 79 90 24 23 89 5 34 76 81 87 53 28 60 55 12 35 1 17 2 20 33 93 71 22 40 56 27 44 10 7...

output:

No

result:

ok "No"

Test #2:

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

input:

6
1 6 2 4 5 3

output:

No

result:

ok "No"

Test #3:

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

input:

6
5 3 2 6 4 1

output:

No

result:

ok "No"

Test #4:

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

input:

6
1 4 5 2 6 3

output:

No

result:

ok "No"

Test #5:

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

input:

6
1 3 5 2 4 6

output:

No

result:

ok "No"

Test #6:

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

input:

6
3 1 6 2 4 5

output:

No

result:

ok "No"

Test #7:

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

input:

6
6 3 5 2 1 4

output:

No

result:

ok "No"

Test #8:

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

input:

6
1 2 5 6 3 4

output:

No

result:

ok "No"

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1172kb

input:

6
5 6 4 1 3 2

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #10:

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

input:

6
5 1 4 3 2 6

output:

No

result:

ok "No"

Test #11:

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

input:

6
1 2 5 4 6 3

output:

No

result:

ok "No"

Test #12:

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

input:

98
46 50 82 72 96 30 28 69 35 29 16 84 95 9 47 68 3 4 74 91 53 64 98 62 66 20 54 33 86 27 65 58 41 4...

output:

No

result:

ok "No"

Test #13:

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

input:

6
5 3 6 4 2 1

output:

No

result:

ok "No"

Test #14:

score: 0
Wrong Answer
time: 0ms
memory: 1168kb

input:

95
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 3...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #15:

score: 0
Wrong Answer
time: 0ms
memory: 1172kb

input:

97
23 24 22 25 21 26 20 27 19 28 18 29 17 30 16 31 15 32 14 33 13 34 12 35 11 36 10 37 9 38 8 39 7 4...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 1172kb

input:

97
81 82 80 83 79 84 78 85 77 86 76 87 75 88 74 89 73 90 72 91 71 92 70 93 69 94 68 95 67 96 66 97 6...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #17:

score: 0
Wrong Answer
time: 0ms
memory: 1168kb

input:

99
84 83 85 82 86 81 87 80 88 79 89 78 90 77 91 76 92 75 93 74 94 73 95 72 96 71 97 70 98 69 99 68 6...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 1168kb

input:

91
29 30 28 31 27 32 26 33 25 34 24 35 23 36 22 37 21 38 20 39 19 40 18 41 17 42 16 43 15 44 14 45 1...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 1168kb

input:

6
2 3 1 4 5 6

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #20:

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

input:

6
1 3 2 4 6 5

output:

Yes

result:

ok "Yes"

Test #21:

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

input:

6
1 5 6 2 4 3

output:

No

result:

ok "No"

Test #22:

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

input:

6
4 1 6 2 3 5

output:

No

result:

ok "No"

Test #23:

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

input:

6
3 2 4 6 5 1

output:

No

result:

ok "No"

Test #24:

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

input:

6
1 5 2 3 6 4

output:

No

result:

ok "No"

Test #25:

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

input:

6
5 6 3 4 2 1

output:

No

result:

ok "No"

Test #26:

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

input:

2
2 1

output:

Yes

result:

ok "Yes"

Test #27:

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

input:

3
2 3 1

output:

Yes

result:

ok "Yes"

Test #28:

score: 0
Wrong Answer
time: 0ms
memory: 1168kb

input:

4
2 3 4 1

output:

Yes

result:

wrong answer 1st words differ - expected: 'No', found: 'Yes'

Test #29:

score: 0
Wrong Answer
time: 123ms
memory: 4284kb

input:

399995
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35...

output:

Yes

result:

wrong answer 1st words differ - expected: 'No', found: 'Yes'

Test #30:

score: 0
Wrong Answer
time: 125ms
memory: 4288kb

input:

399995
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35...

output:

Yes

result:

wrong answer 1st words differ - expected: 'No', found: 'Yes'

Test #31:

score: 0
Wrong Answer
time: 128ms
memory: 4284kb

input:

399997
361233 361232 361234 361231 361235 361230 361236 361229 361237 361228 361238 361227 361239 36...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #32:

score: 2
Accepted
time: 232ms
memory: 4284kb

input:

399992
145795 277226 204608 159687 359376 160924 308780 295747 164870 352092 210204 134571 225860 24...

output:

No

result:

ok "No"

Test #33:

score: 0
Wrong Answer
time: 165ms
memory: 4284kb

input:

399999
306696 306695 306697 306694 306698 306693 306699 306692 306700 306691 306701 306690 306702 30...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #34:

score: 0
Wrong Answer
time: 120ms
memory: 4288kb

input:

399992
205762 205763 205761 205764 205760 205765 205759 205766 205758 205767 205757 205768 205756 20...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #35:

score: 0
Wrong Answer
time: 119ms
memory: 4284kb

input:

399993
114546 114547 114545 114548 114544 114549 114543 114550 114542 114551 114541 114552 114540 11...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #36:

score: 0
Wrong Answer
time: 121ms
memory: 4284kb

input:

399998
157 156 158 155 159 154 160 153 161 152 162 151 163 150 164 149 165 148 166 147 167 146 168 1...

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'

Test #37:

score: 2
Accepted
time: 129ms
memory: 4288kb

input:

399993
59311 171360 52550 358944 248171 11362 248634 315497 378137 328115 242460 353314 228235 39105...

output:

No

result:

ok "No"

Test #38:

score: 2
Accepted
time: 175ms
memory: 4288kb

input:

400000
324248 148340 96118 1146 158654 266246 40598 398288 384392 177432 296798 361271 305285 210690...

output:

No

result:

ok "No"

Test #39:

score: 2
Accepted
time: 235ms
memory: 4284kb

input:

399993
68365 241952 31787 223072 343586 177853 315 272862 146209 326237 380439 12864 330776 22368 24...

output:

No

result:

ok "No"

Test #40:

score: 2
Accepted
time: 126ms
memory: 4284kb

input:

399992
252560 373234 101549 141853 282097 371781 130967 337346 304216 242521 15942 56917 229090 1777...

output:

No

result:

ok "No"