Submission #876210

# Submission time Handle Problem Language Result Execution time Memory
876210 2023-11-21T12:39:18 Z 8pete8 Stranded Far From Home (BOI22_island) C++14
0 / 100
76 ms 10984 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include <iomanip>  
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define ll long long    
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
//#define p push
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#pragma GCC optimize ("03,unroll-lopps")
#pragma GCC target("avx2")
const int mxn=2e5,inf=1e9;
vector<ppii>e;
int val[mxn+10],n,m,pa[mxn+10],sum[mxn+10];
bool ans[mxn+10];
int find(int u){return ((pa[u]==u)?u:pa[u]=find(pa[u]));}
void merg(int u,int v){
    int a=find(u),b=find(v);
    if(a==b)return;
    if(sum[b]<val[u])ans[b]=true;
    else pa[a]=b,ans[b]|=ans[a],sum[b]+=sum[a];
}
int32_t main(){
    fastio
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>val[i],sum[i]=val[i],pa[i]=i;
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        if(val[a]<val[b])swap(a,b);
        e.pb({val[a],{a,b}});
    }
    sort(all(e));
    for(auto i:e)merg(i.s.f,i.s.s);
    for(int i=1;i<=n;i++)cout<<(!ans[find(i)]);
}

Compilation message

island.cpp:35:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   35 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   36 | #pragma GCC target("avx2")
      |                          ^
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
island.cpp:36:26: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Incorrect 1 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 75 ms 10984 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Incorrect 70 ms 9984 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 76 ms 10180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Incorrect 1 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -