Precreation contest files
This commit is contained in:
BIN
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/cpp.out
Executable file
BIN
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/cpp.out
Executable file
Binary file not shown.
16
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/input1
Normal file
16
Codeforces/CodeforcesRound1037(Div3)/EGCD,Unlucky!/input1
Normal 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
|
||||
@@ -0,0 +1,5 @@
|
||||
YES
|
||||
NO
|
||||
YES
|
||||
NO
|
||||
NO
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user