제출 #333550

#제출 시각아이디문제언어결과실행 시간메모리
333550juggernautLongest beautiful sequence (IZhO17_subsequence)C++14
23 / 100
6086 ms2244 KiB
#include<bits/stdc++.h> using namespace std; int n,a[100005],b[100005],i,dp[1<<21],mx,c[100005],path[100005],x; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&a[i]); for(int i=1;i<=n;i++)scanf("%d",&b[i]); for(int i=1;i<=n;i++){ c[i]=1; for(int j=1;j<i;j++){ if(__builtin_popcount(a[j]&a[i])==b[i]&&c[i]<c[j]+1){ c[i]=c[j]+1; path[i]=j; } } if(c[i]>mx){ mx=c[i]; x=i; } } printf("%d\n",mx); stack<int>st; while(x){ st.push(x); x=path[x]; } while(!st.empty()){ printf("%d ",st.top()); st.pop(); } }

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

subsequence.cpp: In function 'int main()':
subsequence.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
subsequence.cpp:6:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |     for(int i=1;i<=n;i++)scanf("%d",&a[i]);
      |                          ~~~~~^~~~~~~~~~~~
subsequence.cpp:7:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     for(int i=1;i<=n;i++)scanf("%d",&b[i]);
      |                          ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...