제출 #1208942

#제출 시각아이디문제언어결과실행 시간메모리
1208942lopkusKpart (eJOI21_kpart)C++20
100 / 100
444 ms4608 KiB
#include<bits/stdc++.h> using namespace std; #define task "differ" #define ii pair<int,int> #define fi first #define se second // #define int long long #define ld double #define mp make_pair #define lg2 20 #define iii pair<int,ii> #define iiii pair<ii,ii> #define fii fi.fi #define fis fi.se #define sfi se.fi #define see se.se int dx[]={0LL,0LL,1,-1,1,1,-1,-1}; int dy[]={1,-1,0LL,0LL,1,-1,1,-1}; const int maxn=1e6+5,maxx=5e4+5; const int mod=1e9+7; int n,a[maxn],f[maxx],check[maxn],s[maxn]; void init() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; s[i]=s[i-1]+a[i]; } } void process() { memset(f,0,sizeof(f)); memset(check,0,sizeof(check)); for(int i=1;i<=n;i++) { for(int j=maxx-1;j>=a[i];j--) { f[j]=max(f[j],f[j-a[i]]); } f[a[i]]=i; for(int k=2;k<=i;k++) { if(((s[i]-s[i-k])&1) || (f[(s[i]-s[i-k])/2]<=i-k))check[k]=1; } } vector<int>ans; for(int k=2;k<=n;k++) { if(!check[k])ans.push_back(k); } cout<<ans.size()<<" "; for(int x:ans)cout<<x<<" "; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout);} int t; cin>>t; while(t--) { init(); process(); cout<<'\n'; } }

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

Main.cpp: In function 'int main()':
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(task".inp","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(task".out","w",stdout);}
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...