Submission #873421

# Submission time Handle Problem Language Result Execution time Memory
873421 2023-11-15T04:56:45 Z vjudge1 Colors (RMI18_colors) C++17
7 / 100
53 ms 17344 KB
#include <bits/stdc++.h>
#define f first
#define S second
#define pb push_back
#define msk(x , y) ((x >> y) & 1)
#define all(x) x.begin() , x.end()
using namespace std;
typedef long long int ll;
const int N = 5e5 + 7;
const ll mod = 1e18;
const int dx[] = {-1,-1,1,1,2,-2,2,-2};
const int dy[] = {-2,2,2,-2,1,1,-1,-1};

int n , m , a[N] , b[N] , used[N];
vector <int > g[N];

void solve(){
	cin >> n >> m ;
	for(int i = 0 ; i <= n; i++) g[i].clear() , used[i] = 0;
	for(int i = 1 ; i <= n; i++)cin >> a[i];
	for(int i = 1 ; i <= n; i++)cin >> b[i];
	int rt = 0 ;
	for(int i = 1 ; i <= m; i++){
		int u , v;
		cin >> u >> v ;
		g[u].pb(v);
		g[v].pb(u);
	}
	for(int i = 1 ; i <= n; i++){
		if(a[i] < b[i]){
			cout << "0\n";
			return ;
		}
		used[a[i]] = 1; 
	}
	for(int i = 1 ; i <= n; i++){
		if(used[b[i]]) continue ;
		cout << "0\n";
		return ;
	}
	cout << "1\n";
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);  
    cout.tie(0);
    int test=1;
    cin >> test ;
    for(int i=1;i<=test;i++){
//      cout << "Case " << i << ": ";
        solve();
     }
}

Compilation message

colors.cpp: In function 'void solve()':
colors.cpp:22:6: warning: unused variable 'rt' [-Wunused-variable]
   22 |  int rt = 0 ;
      |      ^~
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 16988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 17344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 16988 KB Output isn't correct
2 Halted 0 ms 0 KB -