답안 #1008310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1008310 2024-06-26T09:08:06 Z Almonther Bootfall (IZhO17_bootfall) C++
28 / 100
1000 ms 79184 KB
#include <bits/stdc++.h>

#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define co cout<<
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff
int vis[275][270*270+5],arr[275],skipped,ans=0,n,wholesum=0,mp[275*275+5],sum=0;
void rec(int x){
    if(vis[x][sum]||ans) return;
    if(skipped==x){
        rec(x+1);
        return;
    }
    if(x==n+1){
        if(sum==wholesum-sum) ans=1;
        return;
    }
    vis[x][sum]=1;
    if(x==n){
        ll k=wholesum-sum;
        mp[abs(sum-k)]++;
        return;
    }
    sum+=arr[x];
    rec(x+1);
    sum-=arr[x];
    rec(x+1);
}
void solve(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        wholesum+=arr[i];
    }
    skipped=n;
    rec(0);
    if(ans==0){
        co 0;
        return;
    }
    ans=0;
    vector<int>answers;
    for(int i=0;i<n;i++){
        memset(vis,0,sizeof(vis));
        wholesum-=arr[i];
        skipped=i;
        rec(0);
        wholesum+=arr[i];
    }
    for(int i=1;i<=275*275;i++){
        if(mp[i]/2==n) answers.push_back(i);
    }
    
    co answers.size()<<'\n';
    for(auto i:answers) co i<<' ';
}

int main()
{
    suiii
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
10 Correct 75 ms 78940 KB Output is correct
11 Correct 78 ms 78936 KB Output is correct
12 Correct 80 ms 78936 KB Output is correct
13 Correct 70 ms 78940 KB Output is correct
14 Correct 72 ms 78940 KB Output is correct
15 Correct 76 ms 78936 KB Output is correct
16 Correct 79 ms 78940 KB Output is correct
17 Correct 56 ms 79020 KB Output is correct
18 Correct 66 ms 78936 KB Output is correct
19 Correct 77 ms 78940 KB Output is correct
20 Correct 76 ms 79016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
10 Correct 75 ms 78940 KB Output is correct
11 Correct 78 ms 78936 KB Output is correct
12 Correct 80 ms 78936 KB Output is correct
13 Correct 70 ms 78940 KB Output is correct
14 Correct 72 ms 78940 KB Output is correct
15 Correct 76 ms 78936 KB Output is correct
16 Correct 79 ms 78940 KB Output is correct
17 Correct 56 ms 79020 KB Output is correct
18 Correct 66 ms 78936 KB Output is correct
19 Correct 77 ms 78940 KB Output is correct
20 Correct 76 ms 79016 KB Output is correct
21 Correct 211 ms 79184 KB Output is correct
22 Correct 246 ms 78936 KB Output is correct
23 Correct 121 ms 79036 KB Output is correct
24 Correct 343 ms 78940 KB Output is correct
25 Correct 403 ms 78936 KB Output is correct
26 Correct 480 ms 78936 KB Output is correct
27 Correct 368 ms 78932 KB Output is correct
28 Correct 344 ms 78928 KB Output is correct
29 Correct 383 ms 79056 KB Output is correct
30 Correct 399 ms 79040 KB Output is correct
31 Correct 466 ms 78928 KB Output is correct
32 Correct 410 ms 78932 KB Output is correct
33 Correct 217 ms 78928 KB Output is correct
34 Correct 222 ms 78932 KB Output is correct
35 Correct 367 ms 78940 KB Output is correct
36 Correct 419 ms 78940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
10 Correct 75 ms 78940 KB Output is correct
11 Correct 78 ms 78936 KB Output is correct
12 Correct 80 ms 78936 KB Output is correct
13 Correct 70 ms 78940 KB Output is correct
14 Correct 72 ms 78940 KB Output is correct
15 Correct 76 ms 78936 KB Output is correct
16 Correct 79 ms 78940 KB Output is correct
17 Correct 56 ms 79020 KB Output is correct
18 Correct 66 ms 78936 KB Output is correct
19 Correct 77 ms 78940 KB Output is correct
20 Correct 76 ms 79016 KB Output is correct
21 Correct 211 ms 79184 KB Output is correct
22 Correct 246 ms 78936 KB Output is correct
23 Correct 121 ms 79036 KB Output is correct
24 Correct 343 ms 78940 KB Output is correct
25 Correct 403 ms 78936 KB Output is correct
26 Correct 480 ms 78936 KB Output is correct
27 Correct 368 ms 78932 KB Output is correct
28 Correct 344 ms 78928 KB Output is correct
29 Correct 383 ms 79056 KB Output is correct
30 Correct 399 ms 79040 KB Output is correct
31 Correct 466 ms 78928 KB Output is correct
32 Correct 410 ms 78932 KB Output is correct
33 Correct 217 ms 78928 KB Output is correct
34 Correct 222 ms 78932 KB Output is correct
35 Correct 367 ms 78940 KB Output is correct
36 Correct 419 ms 78940 KB Output is correct
37 Execution timed out 1046 ms 78932 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
10 Correct 75 ms 78940 KB Output is correct
11 Correct 78 ms 78936 KB Output is correct
12 Correct 80 ms 78936 KB Output is correct
13 Correct 70 ms 78940 KB Output is correct
14 Correct 72 ms 78940 KB Output is correct
15 Correct 76 ms 78936 KB Output is correct
16 Correct 79 ms 78940 KB Output is correct
17 Correct 56 ms 79020 KB Output is correct
18 Correct 66 ms 78936 KB Output is correct
19 Correct 77 ms 78940 KB Output is correct
20 Correct 76 ms 79016 KB Output is correct
21 Correct 211 ms 79184 KB Output is correct
22 Correct 246 ms 78936 KB Output is correct
23 Correct 121 ms 79036 KB Output is correct
24 Correct 343 ms 78940 KB Output is correct
25 Correct 403 ms 78936 KB Output is correct
26 Correct 480 ms 78936 KB Output is correct
27 Correct 368 ms 78932 KB Output is correct
28 Correct 344 ms 78928 KB Output is correct
29 Correct 383 ms 79056 KB Output is correct
30 Correct 399 ms 79040 KB Output is correct
31 Correct 466 ms 78928 KB Output is correct
32 Correct 410 ms 78932 KB Output is correct
33 Correct 217 ms 78928 KB Output is correct
34 Correct 222 ms 78932 KB Output is correct
35 Correct 367 ms 78940 KB Output is correct
36 Correct 419 ms 78940 KB Output is correct
37 Execution timed out 1046 ms 78932 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 78932 KB Output is correct
2 Correct 30 ms 78872 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 28 ms 78972 KB Output is correct
5 Correct 43 ms 78940 KB Output is correct
6 Correct 39 ms 79044 KB Output is correct
7 Correct 33 ms 78940 KB Output is correct
8 Correct 39 ms 78936 KB Output is correct
9 Correct 37 ms 78920 KB Output is correct
10 Correct 75 ms 78940 KB Output is correct
11 Correct 78 ms 78936 KB Output is correct
12 Correct 80 ms 78936 KB Output is correct
13 Correct 70 ms 78940 KB Output is correct
14 Correct 72 ms 78940 KB Output is correct
15 Correct 76 ms 78936 KB Output is correct
16 Correct 79 ms 78940 KB Output is correct
17 Correct 56 ms 79020 KB Output is correct
18 Correct 66 ms 78936 KB Output is correct
19 Correct 77 ms 78940 KB Output is correct
20 Correct 76 ms 79016 KB Output is correct
21 Correct 211 ms 79184 KB Output is correct
22 Correct 246 ms 78936 KB Output is correct
23 Correct 121 ms 79036 KB Output is correct
24 Correct 343 ms 78940 KB Output is correct
25 Correct 403 ms 78936 KB Output is correct
26 Correct 480 ms 78936 KB Output is correct
27 Correct 368 ms 78932 KB Output is correct
28 Correct 344 ms 78928 KB Output is correct
29 Correct 383 ms 79056 KB Output is correct
30 Correct 399 ms 79040 KB Output is correct
31 Correct 466 ms 78928 KB Output is correct
32 Correct 410 ms 78932 KB Output is correct
33 Correct 217 ms 78928 KB Output is correct
34 Correct 222 ms 78932 KB Output is correct
35 Correct 367 ms 78940 KB Output is correct
36 Correct 419 ms 78940 KB Output is correct
37 Execution timed out 1046 ms 78932 KB Time limit exceeded
38 Halted 0 ms 0 KB -