Submission #1310529

#TimeUsernameProblemLanguageResultExecution timeMemory
1310529em4ma2Secret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" //#include "secret.h" //#include "secret.h" // #include <stdio.h> // #include <stdlib.h> // #define MAX_N 1000 // #define MAX_Q 10000 // #define MAX_VALUE 1000000000 // static int N; // static int A[MAX_N]; // static int Q; // static int L[MAX_Q]; // static int R[MAX_Q]; // static int secret_count; // int Secret(int X, int Y) { // ++secret_count; // if (!(0 <= X && X <= MAX_VALUE)) { // fprintf(stderr, "Wrong Answer [1]\n"); // exit(0); // } // if (!(0 <= Y && Y <= MAX_VALUE)) { // fprintf(stderr, "Wrong Answer [1]\n"); // exit(0); // } // return (X + 2 * (Y / 2) < MAX_VALUE) ? (X + 2 * (Y / 2)) : MAX_VALUE; // } using namespace std; //#define int long long #define ll long long #define pb push_back const int mxsz=1026; int dst[11][mxsz]; int Query(int l,int r){ int L=-1; int x=__builtin_popcount(L)-__builtin_clz((l^r)); return Secret(dst[l][x],dst[r][x]); } int rec(int n,int a[]){ } void Init(int n,int a[]){ int cnt=2; int x=(log2(n)+1); int N=1; while (x--){ N*=2; } vector<int>A; for (int i=0;i<n;i++){ A.pb(a[i]); } for (int i=n;i<N;i++){ A.pb(0); } for (int i=0;i<11;i++){ int k=i+1; int b=0; int cnt2=0; while (k--){ int mx=n/cnt; if (!b){ for (int j=cnt2+mx-1;j>=cnt2;j--){ if (j==cnt2+mx-1)dst[i][j]=A[j]; else dst[i][j]=Secret(dst[i][j-1],A[j]); } cnt2+=mx; b^=1; }else{ for (int j=cnt2+1;j<=cnt2+mx;j++){ if (j==cnt2+1)dst[i][j]=A[j]; else dst[i][j]=Secret(dst[i][j-1],A[j]); } cnt2+=mx; b^=1; } } cnt*=2; } } // signed main(){ // ios::sync_with_stdio(0); // cin.tie(0); // cout.tie(0); // int n; // cin>>n; // int a[n]; // for (int i=0;i<n;i++){ // cin>>a[i]; // } // Init(n,a); // int q; // cin>>q; // while (q--){ // int l,r; // cin>>l>>r; // cout<<Query(l,r)<<endl; // } // return 0; // }

Compilation message (stderr)

secret.cpp: In function 'int Query(int, int)':
secret.cpp:48:12: error: 'Secret' was not declared in this scope
   48 |     return Secret(dst[l][x],dst[r][x]);
      |            ^~~~~~
secret.cpp: In function 'int rec(int, int*)':
secret.cpp:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:78:36: error: 'Secret' was not declared in this scope
   78 |                     else dst[i][j]=Secret(dst[i][j-1],A[j]);
      |                                    ^~~~~~
secret.cpp:85:36: error: 'Secret' was not declared in this scope
   85 |                     else dst[i][j]=Secret(dst[i][j-1],A[j]);
      |                                    ^~~~~~