From bcb5e1b27bb507fa14fbd29e735ad44ec7abda3d Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Thu, 8 Aug 2024 09:13:42 +0800 Subject: [PATCH] update P3865 --- day6/P3865/1.in | 10 ++++++ day6/P3865/P3865.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++ xmake.lua | 12 +++++-- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 day6/P3865/1.in create mode 100644 day6/P3865/P3865.cpp diff --git a/day6/P3865/1.in b/day6/P3865/1.in new file mode 100644 index 0000000..ba879e3 --- /dev/null +++ b/day6/P3865/1.in @@ -0,0 +1,10 @@ +8 8 +9 3 1 7 5 6 0 8 +1 6 +1 5 +2 7 +2 6 +1 8 +4 8 +3 7 +1 8 \ No newline at end of file diff --git a/day6/P3865/P3865.cpp b/day6/P3865/P3865.cpp new file mode 100644 index 0000000..a74d9dc --- /dev/null +++ b/day6/P3865/P3865.cpp @@ -0,0 +1,76 @@ +#include +using namespace std; + +inline int read() +{ + int x=0,f=1;char ch=getchar(); + while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();} + while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();} + return x*f; +} + +#define int long long + +#ifdef OIPRINT +#define PRINT_VALUE(v){cout<<"[DEBUG]: "<<#v<<" :"<<(v)<b?a:b; +} + + + +const int MAX_N = 1e5+5,MAX_K=17; +int n,m,s[MAX_N][MAX_K],l[MAX_N]; + + + +signed main(){ + // cin.sync_with_stdio(false); + // cin.tie(0); + // cin>>n>>m; + n=read(); + m=read(); + PRINT_VALUE(n); + PRINT_VALUE(m); + + l[1]=0; + // for(int i=2;i<=n;i++){ + // l[i]=l[i/2]+1; + // } + for(int i=1;i<=n;i++){ + // cin>>s[i][0]; + s[i][0]=read(); + PRINT_VALUE(s[i][0]); + if(i!=1)l[i]=l[i/2]+1; + } + int k=l[n]+1; + for(int j=1;j<=k;j++){ + for(int i=1;i-1+(1<>le>>r; + le=read(); + r=read(); + PRINT_VALUE(le-r+1); + int j=l[r-le+1]; + PRINT_VALUE(le); + PRINT_VALUE(r); + PRINT_VALUE(j); + // PRINT_VALUE(s[le][j]); + // PRINT_VALUE(s[r-(1<