UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#210150#3780. 选择翻转cql100594ms8984kbC++11372b2024-08-06 08:35:022024-08-06 12:00:30

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
	int n, res; cin >> n;
	vector<int> v(n + 1);
	for (int i = 1; i <= n; i++)
		scanf("%lld", &v[i]);
	res = abs(v[n] - v[1]);
	for (int i = 2; i < n; i++)
		res = max(res, v[n] - v[i]);
	for (int i = 2; i < n; i++)
		res = max(res, v[i] - v[1]);
	cout << res;
	return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 0ms
memory: 1280kb

input:

1000
570728598 78380612 752009160 483622388 690675777 839701830 785601424 269638493 470443394 524296...

output:

571510733

result:

ok "571510733"

Test #2:

score: 10
Accepted
time: 0ms
memory: 1280kb

input:

1000
523121450 617641109 998599679 902664380 883696004 599125849 511039052 910900916 930157627 65125...

output:

476278378

result:

ok "476278378"

Test #3:

score: 10
Accepted
time: 0ms
memory: 1284kb

input:

1000
2940000 4740000 3750000 2580000 2640000 1620000 6840000 7260000 2580000 4860000 8940000 6270000...

output:

6060000

result:

ok "6060000"

Test #4:

score: 10
Accepted
time: 65ms
memory: 8984kb

input:

1000000
2 2 2 1 1 1 1 1 1 2 2 2 1 1 1 1 1 2 2 2 1 1 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 2 1 2 1 1 1 ...

output:

1

result:

ok "1"

Test #5:

score: 10
Accepted
time: 68ms
memory: 8984kb

input:

1000000
2 1 1 1 2 1 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 1 2 2 1 1 1 2 1 1 1 ...

output:

1

result:

ok "1"

Test #6:

score: 10
Accepted
time: 71ms
memory: 8980kb

input:

1000000
1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 2 1 2 1 2 2 2 2 2 2 1 1 1 2 2 1 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 ...

output:

1

result:

ok "1"

Test #7:

score: 10
Accepted
time: 104ms
memory: 8984kb

input:

1000000
318646548 966361467 446289951 334795520 851916640 788241987 217528299 488090445 34266886 203...

output:

951879184

result:

ok "951879184"

Test #8:

score: 10
Accepted
time: 94ms
memory: 7400kb

input:

800000
498650216 784115938 534380004 928957839 962301970 194418961 126334785 792777182 745314326 876...

output:

501347498

result:

ok "501347498"

Test #9:

score: 10
Accepted
time: 109ms
memory: 8980kb

input:

1000000
343609688 60168770 513006292 112522542 710081534 997142492 166645644 24843096 205270658 1061...

output:

656389918

result:

ok "656389918"

Test #10:

score: 10
Accepted
time: 83ms
memory: 8984kb

input:

1000000
1000002 1000000 999999 999998 999997 999996 999995 999994 999993 999992 999991 999990 999989...

output:

1000000

result:

ok "1000000"

Extra Test:

score: 0
Extra Test Passed