# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
332242 |
2020-12-01T18:41:44 Z |
a_player |
Colors (RMI18_colors) |
C++14 |
|
980 ms |
2924 KB |
#include <bits/stdc++.h>
using namespace std;
const int nax=1e5+5;
vector<int> grafo[nax];
int a[nax],b[nax];
void solve(){
for(int i=0;i<nax;i++){
grafo[i].clear();
}
int n,m;
cin>>n>>m;
int root=-1;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
for(int i=0;i<m;i++){
int u,v;
cin>>u>>v;
u--,v--;
grafo[u].push_back(v);
grafo[v].push_back(u);
if(grafo[u].size()>1)root=u;
if(grafo[v].size()>1)root=v;
}
if(a[root]!=b[root]){
for(int i=0;i<n;i++)if(min(a[i],a[root])==b[root])a[root]=min(a[i],a[root]),i=n;
}
for(int i=0;i<n;i++){
if(a[i]!=b[i]&&min(a[i],a[root])!=b[i]){
cout<<0<<endl;
return;
}
}
cout<<1<<endl;
}
int main(){
int tt;
cin>>tt;
while(tt--)solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
698 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
196 ms |
2668 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
709 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
709 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
698 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
980 ms |
2924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
698 ms |
2796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |