답안 #171035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171035 2019-12-27T06:21:57 Z beksultan04 Bootfall (IZhO17_bootfall) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK");
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define rep(i,n) for (i=0;i<(n);++i)
#define rep1(i,n) for (i=1;i<=(n);++i)
#define ret return
#define nemeshay ios::sync_with_stdio(0),cin.tie(0);
const int N=1e6+12,INF=1e9+7;
int q[N],coor[N];
main(){
    int i,ans=0,j,n;
    cin>>n;
    set <int> s;
    rep(i,n){
        cin>>q[i];
        s.insert(q[i]);
    }
    sort(q,q+n);
    i=1;j=n-2;
    int l=q[0],r=q[n-1];
    while (j-i>=0){
        if (l<=r){
            l+=q[i];
            i++;
        }
        else {
            r+=q[j];
            j--;
        }
    }
    if (l!=r){
        cout <<0;
        ret 0;
    }
    else{
        cout <<s.size()<<"\n";
        while (!s.empty()){
            cout <<*s.begin()<<" ";
            s.erase(s.begin());
        }
    }
}

Compilation message

bootfall.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
bootfall.cpp: In function 'int main()':
bootfall.cpp:19:11: warning: unused variable 'ans' [-Wunused-variable]
     int i,ans=0,j,n;
           ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -