Hii i have one doubt you are online you can only give me 2 minutes
For this problem we know that if x and second element is. Not zero that means it possible to open all door else no
Suppose array[x]== 0 means not possible for first position How this second position give Array[Array[x]]
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
cin>>n;
while(n--){
int x,a[4]={};
cin>>x>>a[1]>>a[2]>>a[3];
if(a[x]==0)cout<<"NO\n";
else if(a[a[x]]==0)cout<<"NO\n";
else cout<<"YES\n";
}
}
我打完CF132后 thefirste93 向我发了以上内容,但Google翻译太草了,我看不动,求助。