Submission #261976

# Submission time Handle Problem Language Result Execution time Memory
261976 2020-08-12T08:41:13 Z errorgorn Colors (RMI18_colors) C++14
7 / 100
123 ms 3968 KB
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n,m;
int arr[150005];
int brr[150005];
vector<int> al[150005];
set<int> exists;

void solve(){
	cin>>n>>m;
	rep(x,1,n+1){
		al[x].clear();
	}
	exists.clear();
	
	rep(x,1,n+1) cin>>arr[x];
	rep(x,1,n+1) cin>>brr[x];
	
	int a,b;
	rep(x,0,m){
		cin>>a>>b;
		
		al[a].push_back(b);
		al[b].push_back(a);
	}
	
	rep(x,1,n+1) exists.insert(arr[x]);
	rep(x,1,n+1){
		if (!exists.count(brr[x]) || brr[x]>arr[x]){
			cout<<0<<endl;
			return;
		}
	}
	
	cout<<1<<endl;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int TC;
	cin>>TC;
	while (TC--){
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 3948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 56 ms 3840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 3964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 3964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 3948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 3968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 3948 KB Output isn't correct
2 Halted 0 ms 0 KB -