제출 #1089242

#제출 시각아이디문제언어결과실행 시간메모리
1089242vjudge1Kpart (eJOI21_kpart)C++17
0 / 100
1386 ms1048576 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll int #define F first #define S second #define ull unsigned long long #define db double #define ldb long double #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define yes cout<<"YES\n" #define no cout<<"NO\n" #define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> #define all(x) x.begin(), x.end() const int mod = 1e9 + 7; const int N = 100001; using namespace std; using namespace __gnu_pbds; ll n, m, k, p[N], f[N], a, b, dp[N], ans[N]; vector <ll> v, q; signed main (){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tt; cin >> tt; while (tt--){ cin >> n; for (int i = 1; i <= n; i++){ cin >> p[i]; ans[i] = 1; } ans[1] = 0; for (int i = 1; i <= n; i++){ dp[0] = 1; a = 0; q.clear(); q.pb(0); q.pb(p[i]); dp[p[i]] = 1; a += p[i]; for (int y = i + 1; y <= n; y++){ a += p[y]; v.clear(); for (int j = 0; j < q.size(); j++){ v.pb (q[j] + p[y]); dp[q[j] + p[y]] = 1; } for (auto j: v){ q.pb(j); } if (a % 2 == 1 || dp[a / 2] == 0){ ans[y - i + 1] = 0; } } for (auto y: q){ dp[y] = 0; } } v.clear(); for (int i = 1; i <= n; i++){ if (ans[i]){ v.pb (i); } } cout << v.size() << ' '; for (auto i: v){ cout << i << ' '; } cout << '\n'; } }

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

Main.cpp: In function 'int main()':
Main.cpp:52:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for (int j = 0; j < q.size(); j++){
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...