Submission #635211

# Submission time Handle Problem Language Result Execution time Memory
635211 2022-08-25T16:39:26 Z PanTkd Stranded Far From Home (BOI22_island) C++14
0 / 100
0 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;
void solve(){
    ll n,m;cin>>n>>m;
    vi s(n+1,ll());
    for(ll i=1;i<=n;i++)cin>>s[i];
    vi pr(n+1,0);
    pr[n]=s[n];
    ll sum=0;
    for(ll i=n-1;i>=1;i--)pr[i]=pr[i+1]+s[i];
    for(ll i=1;i<=n;i++)sum+=s[i];
    string ans;
    for(ll i=1;i<=n;i++){
        if(pr[i]>=sum-pr[i]){
            ans+='1';
        }
        else ans+='0';
    }
    cout<<ans<<endl;
    return ;
    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);
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;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 0 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 -
# 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 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -