Precreation contest files
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
3
|
||||
3
|
||||
2 2 3
|
||||
5
|
||||
4 5 5 2 4
|
||||
1
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
NO
|
||||
YES
|
||||
4
|
||||
4 5 2 4
|
||||
NO
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> a(n);
|
||||
for (int &i : a)
|
||||
cin >> i;
|
||||
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
if (a[i] > a[i + 1]) {
|
||||
cout << "YES\n2\n";
|
||||
cout << a[i] << " " << a[i + 1] << "\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
cout << "NO\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
3
|
||||
2
|
||||
1 2
|
||||
3
|
||||
1 2 3
|
||||
4
|
||||
3 0 2 3
|
||||
@@ -0,0 +1,3 @@
|
||||
2
|
||||
2
|
||||
3
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
vector<int> a(n);
|
||||
for (auto &i : a)
|
||||
cin >> i;
|
||||
|
||||
cout << min(a[0] + a[1], 2 * a[0]) << "\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int t;
|
||||
cin >> t;
|
||||
while (t--)
|
||||
solve();
|
||||
}
|
||||
Reference in New Issue
Block a user