diff options
Diffstat (limited to 'contests/Round809/A/B')
| -rwxr-xr-x | contests/Round809/A/B/C/D/E/F/main.cpp | 13 | ||||
| -rwxr-xr-x | contests/Round809/A/B/C/D/E/main.cpp | 13 | ||||
| -rwxr-xr-x | contests/Round809/A/B/C/D/main.cpp | 13 | ||||
| -rwxr-xr-x | contests/Round809/A/B/C/main.cpp | 13 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main | bin | 0 -> 31808 bytes | |||
| -rwxr-xr-x | contests/Round809/A/B/main.cpp | 58 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_input0.txt | 13 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_input1.txt | 3 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_input2.txt | 3 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_input3.txt | 3 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_output0.txt | 6 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_output1.txt | 1 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_output2.txt | 1 | ||||
| -rwxr-xr-x | contests/Round809/A/B/main_output3.txt | 1 |
14 files changed, 141 insertions, 0 deletions
diff --git a/contests/Round809/A/B/C/D/E/F/main.cpp b/contests/Round809/A/B/C/D/E/F/main.cpp new file mode 100755 index 0000000..9549f1d --- /dev/null +++ b/contests/Round809/A/B/C/D/E/F/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + + } +} diff --git a/contests/Round809/A/B/C/D/E/main.cpp b/contests/Round809/A/B/C/D/E/main.cpp new file mode 100755 index 0000000..9549f1d --- /dev/null +++ b/contests/Round809/A/B/C/D/E/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + + } +} diff --git a/contests/Round809/A/B/C/D/main.cpp b/contests/Round809/A/B/C/D/main.cpp new file mode 100755 index 0000000..9549f1d --- /dev/null +++ b/contests/Round809/A/B/C/D/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + + } +} diff --git a/contests/Round809/A/B/C/main.cpp b/contests/Round809/A/B/C/main.cpp new file mode 100755 index 0000000..9549f1d --- /dev/null +++ b/contests/Round809/A/B/C/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + + } +} diff --git a/contests/Round809/A/B/main b/contests/Round809/A/B/main Binary files differnew file mode 100755 index 0000000..12f7c31 --- /dev/null +++ b/contests/Round809/A/B/main diff --git a/contests/Round809/A/B/main.cpp b/contests/Round809/A/B/main.cpp new file mode 100755 index 0000000..90c55c2 --- /dev/null +++ b/contests/Round809/A/B/main.cpp @@ -0,0 +1,58 @@ +#include <bits/stdc++.h> + +using namespace std; + +bool isCool(vector<int> &a, int i) { + if (i == 0) { + return false; + } + if (a[i - 1] < a[i] && a[i + 1] < a[i]) { + return true; + } + return false; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + int n; + cin >> n; + vector<int> a(n); + for (int &x : a) + cin >> x; + long long ans = 0; + long long mx = 0; + int max_cool = (n - 1) / 2; + int cnt = 0; + if(n > 3) { + for (int i = 1; i < n - 1; i++) { + if(isCool(a,i)) { + cnt++; + } + if (!isCool(a, i) && i % 2 == 0) { + ans += abs(a[i] - max(a[i - 1], a[i + 1])) + 1; + } else if(!isCool(a, i) && i % 2 != 0) { + mx += abs(a[i] - max(a[i - 1], a[i + 1])) + 1; + } + } + long long mx2 = 0; + for (int i = 1; i < n - 1; i += 3) { + if (!isCool(a, i)) { + mx2 += abs(a[i] - max(a[i - 1], a[i + 1])) + 1; + } + } + cerr << mx << " " << ans << " " << mx2 << endl; + if(cnt < max_cool) { + // cout << max(mx2, max(ans, mx)) << endl; + } else { + cout << min(mx2, min(ans, mx)) << endl; + } + + } else { + cout << abs(a[1] - max(a[0], a[2])) + 1 << endl; + } + } +} diff --git a/contests/Round809/A/B/main_input0.txt b/contests/Round809/A/B/main_input0.txt new file mode 100755 index 0000000..3781f01 --- /dev/null +++ b/contests/Round809/A/B/main_input0.txt @@ -0,0 +1,13 @@ +6 +3 +2 1 2 +5 +1 2 1 4 3 +6 +3 1 4 5 5 2 +8 +4 2 1 3 5 3 6 1 +6 +1 10 1 1 10 1 +8 +1 10 11 1 10 11 10 1 diff --git a/contests/Round809/A/B/main_input1.txt b/contests/Round809/A/B/main_input1.txt new file mode 100755 index 0000000..07c8f0a --- /dev/null +++ b/contests/Round809/A/B/main_input1.txt @@ -0,0 +1,3 @@ +1 +4 +1 2 2 1
\ No newline at end of file diff --git a/contests/Round809/A/B/main_input2.txt b/contests/Round809/A/B/main_input2.txt new file mode 100755 index 0000000..b5a46e0 --- /dev/null +++ b/contests/Round809/A/B/main_input2.txt @@ -0,0 +1,3 @@ +1 +5 +1 1 1 4 3
\ No newline at end of file diff --git a/contests/Round809/A/B/main_input3.txt b/contests/Round809/A/B/main_input3.txt new file mode 100755 index 0000000..fb1fbc0 --- /dev/null +++ b/contests/Round809/A/B/main_input3.txt @@ -0,0 +1,3 @@ +1 +7 +1000000000 1 1000000000 1 1000000000 1 1000000000
\ No newline at end of file diff --git a/contests/Round809/A/B/main_output0.txt b/contests/Round809/A/B/main_output0.txt new file mode 100755 index 0000000..6a9dd24 --- /dev/null +++ b/contests/Round809/A/B/main_output0.txt @@ -0,0 +1,6 @@ +2 +0 +3 +3 +0 +4 diff --git a/contests/Round809/A/B/main_output1.txt b/contests/Round809/A/B/main_output1.txt new file mode 100755 index 0000000..56a6051 --- /dev/null +++ b/contests/Round809/A/B/main_output1.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/Round809/A/B/main_output2.txt b/contests/Round809/A/B/main_output2.txt new file mode 100755 index 0000000..56a6051 --- /dev/null +++ b/contests/Round809/A/B/main_output2.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/Round809/A/B/main_output3.txt b/contests/Round809/A/B/main_output3.txt new file mode 100755 index 0000000..c227083 --- /dev/null +++ b/contests/Round809/A/B/main_output3.txt @@ -0,0 +1 @@ +0
\ No newline at end of file |
