답안 #635209

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635209 2022-08-25T16:37:48 Z PanTkd Stranded Far From Home (BOI22_island) C++14
0 / 100
1 ms 468 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-1]){
            ans+='1';
        }
        else ans+='0';
    }
    cout<<ans<<endl;
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -