제출 #343959

#제출 시각아이디문제언어결과실행 시간메모리
343959KWang31Longest beautiful sequence (IZhO17_subsequence)C++98
컴파일 에러
0 ms0 KiB
#include "subsequence.h" #include <bits/stdc++.h> #include <iostream> #define pb push_back using namespace std; const int MAX = 1 << 10; int main(){ int btcnt[MAX]; for(int i=0;i<MAX;i++){btcnt[i]=__builtin_popcount(i);} int N; scanf("%d",&N);int a[N]; int k[N]; for(int i=0;i<N;i++){ scanf("%d",&a[i]); } for(int i=0;i<N;i++){ scanf("%d",&k[i]); } int M[MAX][MAX][11]; int ind[MAX][MAX][11]; for(int i=0;i<MAX;i++) for(int j=0;j<MAX;j++) for(int k=0;k<11; k++) M[i][j][k]=-1; int q,z; int r=a[0]&(MAX-1); int prev[N]; int ans[N]; for(int i=0;i<N;i++) { q=a[i]>>10; r=a[i]&(MAX-1); ans[i]++; for(int j=0;j<MAX;j++) {//QUERY z=k[i]-btcnt[r&j]; if(z>=0 && z<=10 ) { //The first 10 bits have EXACTLY z bits in common if( M[q][j][z]+1>ans[i]) { ans[i]=M[q][j][z]+1; prev[i]=ind[q][j][z]; } } } //UPDATE for(int j=0;j<MAX;j++) { if(M[j][r][btcnt[j&q]]<ans[i]) { M[j][r][btcnt[j&q]]=ans[i]; ind[j][r][btcnt[j&q]]=i; } } } int mx=0; int cur=-1; for(int i=0;i<N;i++) { if(ans[i]>mx) { mx=ans[i]; cur=i; } } printf("%d\n", mx); vector<int> seq; seq.pb(cur+1); while(cur>0){ cur=prev[cur]; seq.pb(cur+1); } for (int i=mx-1; i>=0; i--){ printf("%d ", seq[i]); } return 0; }

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

subsequence.cpp:1:10: fatal error: subsequence.h: No such file or directory
    1 | #include "subsequence.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.