제출 #1128111

#제출 시각아이디문제언어결과실행 시간메모리
1128111_TemirhanBootfall (IZhO17_bootfall)C++20
0 / 100
11 ms2116 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sz(x) x.size() #define F first #define S second #define nl '\n' void Tima() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const int N = 501 * 501; const int inf = 1e12; const int mod = 998244353; signed main() { // Tima(); ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >>n; int a[n + 1], sum = 0; for( int i = 1; i <= n; ++i ) { cin >>a[i]; sum += a[i]; } bool dp[n + 1][N]; for( int i = 1; i <= n; ++i ) for( int w = 0; w < N; ++w ) dp[i][w] = 0; for( int k = 1; k <= n; ++k ) { dp[k][0] = 1; for( int i = 1; i <= n; ++i ) { if( i == k ) continue; for( int w = N - 1; w >= a[i]; --w ) if( dp[k][w - a[i]] == 1 ) dp[k][w] = 1; } } vector< int >ans; for( int x = 1; x <= N; ++x ) { int cnt = 0; for( int k = 1; k <= n; ++k ) { int s = sum - a[k]; if( (s + x) & 1 ) continue; if( dp[k][(s + x) / 2 - x] && dp[k][(s + x) / 2] ) ++cnt; } if( cnt == n ) ans.pb( x ); } cout <<sz(ans) <<nl; for( int i: ans ) cout <<i <<' '; }

컴파일 시 표준 에러 (stderr) 메시지

bootfall.cpp: In function 'void Tima()':
bootfall.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bootfall.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...