This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int unsigned long
using namespace std;
signed main() {
int n,m;
cin >> n >> m;
bool q=false;
int a[500000],b[500000];
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<m;i++){
cin >> b[i];
}
for(int i=0;i<m;i++){
for(int j=i;j<=m;j++){
for(int z=j;z<=m;z++){
if(b[i]+b[j]+b[z]==a[i] || a[i]==b[i]){
q=true;
}
}
}
}
if(q){
cout << "YES";
}
else{
cout << "NO";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |