/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 4ms 5.836 MiB
#2 Wrong Answer 4ms 5.777 MiB
#3 Wrong Answer 4ms 5.809 MiB

Code

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define bug(a) cout<<#a<<" : "<<a<<endl;
#define bug2(a,b) cout<<#a<<" : "<<a<<"\t"<<#b<<" : "<<b<<endl;

const int N=2e5+7;
vector<int>g[N];
vector<int>v,dis(N,1e9);
int n;
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t=1;
    while(t--){
        cin>>n;
        v.resize(n+1);
        for(int i=1;i<=n;i++){
            cin>>v[i];
        }
        for(int i=0;i<n-1;i++){
            int u,v;cin>>u>>v;
            g[u].push_back(v);
            g[v].push_back(u);
        }
        queue<int>q;
        for(int i=1;i<=n;i++){
            if(v[i]==1){
                q.push(i);
                dis[i]=0;
            }
        }
        // for(int i=1;i<=n;i++){
        //     cout<<dis[i]<<' ';
        // }
        while(!q.empty()){
            int u=q.front();
            q.pop();
            for(auto v:g[u]){
                // dis[j]=min(dis[j],dis[it.first]+1);
                if(dis[u]+1<dis[v]){
                    dis[v]=dis[u]+1;
                    q.push(v);
                }
            }
        }
        // bug(q.size())
        // for(int i=1;i<=n;i++){
        //     cout<<dis[i]<<' ';
        // }
        int qq;cin>>qq;
        while(qq--){
            int u,v;cin>>u>>v;
            if(!(dis[u]<dis[v])){
                cout<<"weee"<<endl;
                
            }
            else {
                cout<<"oops"<<endl;
            }
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1134 Terrorist attack in Seriousland
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 06:48:01
Judged At
2024-12-09 06:48:01
Judged By
Score
3
Total Time
4ms
Peak Memory
5.836 MiB