제출 #1089538

#제출 시각아이디문제언어결과실행 시간메모리
1089538vjudge1Kpart (eJOI21_kpart)C++17
0 / 100
56 ms1884 KiB
/** * data : 09.07.2024 * **/ #include <bits/stdc++.h> // #include "algo/turnikmen.h" using namespace std; #define int long long #define bitt __builtin_popcountll #define bitzero __builtin_clz #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") // #pragma GCC optimize("-funsafe-loop-optimizations") #pragma GCC optimize("-funroll-loops") // #pragma GCC optimize("-fwhole-program") #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-falign-functions") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fcse-follow-jumps") // #pragma GCC optimize("-fcse-skip-blocks") #pragma GCC optimize("-fdelete-null-pointer-checks") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-finline-small-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fpartial-inlining") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("-fsched-interblock") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") // #pragma GCC optimize("-fstrict-overflow") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC target("avx") void fReopen () { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } signed main (/* time : 9:17 AM */) { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; while (t --> 0) { int n; cin >> n; vector<int> a(n); for (auto &x : a) cin >> x; vector<int> valid(n + 1, 1); const int N = 1e5 + 3; int dp[N], pref[N]; pref[0] = 0; for (int i = 1; i <= n; i++) { pref[i] = pref[i - 1] + a[i - 1]; } for (int i = 0; i <= pref[n]; i++) dp[i] = 0; for (int i = 1; i <= n; i++) { for (int j = pref[n]; j >= a[i]; j--) { dp[j] = max(dp[j], dp[j - a[i]]); } dp[a[i - 1]] = i; for (int j = 1; j <= i - 1; j++) { int sum = pref[i] - pref[j - 1]; if (sum % 2 != 0 || dp[sum / 2] < j)/* cout << i - j + 1 << ' ', */valid[i - j + 1] = 0; } } vector<int> ans; for (int i = 2; i <= n; i++) if (valid[i]) ans.push_back(i); cout << ans.size() << ' '; for (auto to : ans) cout << to << ' '; cout << endl; } }

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

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