답안 #566206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
566206 2022-05-22T06:27:47 Z RealSnake Bootfall (IZhO17_bootfall) C++14
6 / 100
1000 ms 324 KB
#include "bits/stdc++.h"
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define ll long long
#define mod 1000000007

ofstream fout(".out");
ifstream fin(".in");

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int arr[n + 1];
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    if(sum % 2) {
        cout << 0;
        return 0;
    }
    vector<int> ans;
    for(int i = 1; i <= 2400; i++) {
        arr[n] = i;
        bool b = 1;
        for(int j = 0; j <= n; j++) {
            if(i > sum || arr[n] % 2 != arr[j] % 2) {
                b = 0;
                break;
            }
            sum += arr[n];
            sum -= arr[j];
            swap(arr[j], arr[n]);
            int x;
            for(int o = 0; o < (1 << n); o++) {
                x = 0;
                for(int k = 0; k < n; k++) {
                    if(o & (1 << k))
                        x += arr[k];
                }
                if(x == sum / 2)
                    break;
            }
            if(x != sum / 2)
                b = 0;
            sum += arr[n];
            sum -= arr[j];
            swap(arr[j], arr[n]);
            if(!b)
                break;
        }
        if(b)
            ans.push_back(i);
    }
    cout << ans.size() << "\n";
    for(int i : ans)
        cout << i << " ";

    return 0;
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:55:13: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   55 |             if(x != sum / 2)
      |             ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Execution timed out 1090 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Execution timed out 1090 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Execution timed out 1090 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Execution timed out 1090 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 108 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 159 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Execution timed out 1090 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -