Submission #746208

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7462082023-05-21 22:32:49PVSekharLongest beautiful sequence (IZhO17_subsequence)C++14
0 / 100
113 ms262144 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9+7;
const ll N=(1<<10);
int a[21],k[21];
int dp[N][N][11]; //prev right,cur left half,extra k to match cur left half
int ind[N][N][11]; //ind used to reach this state
int bc[N][N]; //bit count
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin);
freopen("output.out", "w", stdout);
#endif
for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)dp[i][j][k]=0;
for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)ind[i][j][k]=-1;
for(int i=0;i<N;i++)for(int j=0;j<N;j++)bc[i][j]=__builtin_popcount(i&j);
int n;
cin>>n;
for (int i = 0; i < n; i++)cin>>a[i];
for (int i = 0; i < n; i++)cin>>k[i];
int p[n]; //stores previous index
for(int i=0;i<n;i++)p[i]=i;
int ans=0,ans_i,len,extra;
for (int i = 0; i < n; i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

subsequence.cpp: In function 'int main()':
subsequence.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
subsequence.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  freopen("output.out", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
subsequence.cpp:19:77: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
   19 |     for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)dp[i][j][k]=0;
      |                                                                  ~~~~~~~~~~~^~
subsequence.cpp:19:58: note: within this loop
   19 |     for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)dp[i][j][k]=0;
      |                                                         ~^~~
subsequence.cpp:20:78: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
   20 |     for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)ind[i][j][k]=-1;
      |                                                                  ~~~~~~~~~~~~^~~
subsequence.cpp:20:58: note: within this loop
   20 |     for(int i=0;i<N;i++)for(int j=0;j<N;j++)for(int k=0;k<21;k++)ind[i][j][k]=-1;
      |                                                         ~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...