답안 #540754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540754 2022-03-21T16:50:06 Z amin 비밀 (JOI14_secret) C++14
0 / 100
20000 ms 4700 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;



long n;
long u;
long a[130000];
map<pair<long,long>,long>m;
void build(long v,long tl,long tr)
{
 if(tl==tr)
 {
     return ;
 }
    long tm=(tl+tr)/2;
    long ans=tl;
    for(long i=tl+1;i<=tm;i++)
    {
        ans=Secret(ans,a[i]);
        m[{tl,i}]=ans;
    }
    ans=a[tm+1];
     for(long i=tm+2;i<=tr;i++)
    {
        ans=Secret(ans,a[i]);

        m[{i,tr}]=ans;
    }
    build(v*2,tl,tm);
    build(v*2+1,tm+1,tr);

}
long get(long v,long tl,long tr,long l,long r)
{
    long tm=(tl+tr)/2;
    if(r<=tm)
    {
       return get(v*2,tl,tm,l,r);
    }
    if(l>tm)
    {
        return get(v*2+1,tm+1,tr,l,r);
    }
    long ans=Secret(m[{l,tm}],m[{tm+1,r}]);
    return ans;
}
void Init(int N, int A[]) {

  n=N;
  for(long i=0;i<N;i++)
  {
      a[i]=A[i];
      m[{a[i],a[i]}]=a[i];
  }
  build(1,0,n-1);
}

int Query(int L, int R) {
    return get(1,0,n-1,L-1,R-1);
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 113 ms 2576 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 823607627.
2 Incorrect 122 ms 2624 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 404951265.
3 Incorrect 116 ms 2540 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 622141456.
4 Incorrect 426 ms 4688 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 439 ms 4700 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Execution timed out 20054 ms 4684 KB Time limit exceeded
7 Incorrect 502 ms 4684 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 471 ms 4652 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 467 ms 4596 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 485 ms 4612 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.