Submission #1221762

#TimeUsernameProblemLanguageResultExecution timeMemory
1221762Robert_juniorKpart (eJOI21_kpart)C++20
0 / 100
1 ms328 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define ins insert #define pb push_back #define F first #define S second const int N = 1e6+4, M = 5e5 + 7; const int mod = 1e9 + 7; int a[N], ok[N]; void solve(){ int n; cin>>n; for(int i = 1; i <= n; i++){ cin>>a[i]; ok[i] = 1; } for(int i = 1; i <= n; i++){ int sum = 0, mx = 0; for(int j = i; j <= n; j++){ sum += a[j]; mx = max(mx, a[j]); if(mx * 2 > sum || sum % 2 == 1){ ok[(j - i + 1)] = 0; } } } vector<int>res; for(int i = 2; i <= n; i++) if(ok[i]) res.pb(i); cout<<res.size()<<' '; for(auto it : res) cout<<it<<' '; cout<<'\n'; } main(){ ios_base :: sync_with_stdio(false); cin.tie(nullptr); int t = 1; cin>>t; for(int i = 1; i <= t; i++){ //cout<<"Case "<<i<<": "; solve(); } }

Compilation message (stderr)

Main.cpp:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...