Submission #635220

# Submission time Handle Problem Language Result Execution time Memory
635220 2022-08-25T16:52:44 Z PanTkd Stranded Far From Home (BOI22_island) C++14
0 / 100
1 ms 212 KB
//
//  main.cpp
//
//  Created by Panagiotis Chadjicostas on
//  Copyright © Panagiotis Hadjicostas. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

typedef int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#ifdef px
    #define p(x) cerr<<#x<<' '<<x<<endl;
#else
    #define p(x) {}
#endif
#define F first
#define S second
#define sz size
#define ls s,m,idx<<1
#define rs m+1,e,idx<<1|1
const ll MOD=ll(1e9)+7;
const ll MAXN=2*ll(1e6);
///////////////////////////////////////////////////////////////////////
vector<vi> A;
vi V;
vi S;
void dfs(ll s){
    V[s]=1;
    for(auto x:A[s]){
        if(!V[x]){
            if(S[s]>=S[x])
                dfs(x);
        }
    }
}
void solve(){
    ll n,m;cin>>n>>m;
    S.assign(n+1,0);
    for(ll i=1;i<=n;i++)cin>>S[i];
    
    A.assign(n+1,vi());
    for(ll i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        A[a].push_back(b);A[b].push_back(a);
    }
    string ans;
    for(ll i=1;i<=n;i++){
        V.assign(n+1,0);
        bool f=0;
        for(ll j=1;j<=n;j++)if(!V[j]){ans+='0';f=1;break;}
        if(!f)ans+='1';
    }cout<<ans<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;//cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -