Precreation contest files

This commit is contained in:
2026-02-11 11:28:23 +07:00
parent 0a8ea477bb
commit cb9f7cab30
134 changed files with 1848 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,16 @@
5
6
72 24 3 3 3 3
3 3 3 6 12 144
3
1 2 3
4 5 6
5
125 125 125 25 25
25 25 25 25 75
4
123 421 282 251
125 1981 239 223
3
124 521 125
125 121 121

View File

@@ -0,0 +1,5 @@
YES
NO
YES
NO
NO

View File

@@ -0,0 +1,48 @@
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> pre(n), stu(n);
for (int &i : pre)
cin >> i;
for (int &i : stu)
cin >> i;
if (pre[n - 1] != stu[0]) {
cout << "NO\n";
return;
}
for (int i = 0; i < n - 1; i++) {
if (pre[i] < pre[i + 1]) {
cout << "NO\n";
return;
}
if (pre[i] % pre[i + 1] != 0) {
cout << "NO\n";
return;
}
}
for (int i = n - 1; i > 0; i--) {
if (stu[i] < stu[i - 1]) {
cout << "NO\n";
return;
}
if (stu[i] % stu[i - 1] != 0) {
cout << "NO\n";
return;
}
}
cout << "YES\n";
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}