답안 #1106086

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106086 2024-10-29T08:08:18 Z hainam2k9 비밀 (JOI14_secret) C++17
0 / 100
339 ms 19348 KB
#include <bits/stdc++.h>
#include <secret.h>
#define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0)
#define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define db long double
#define sz(a) ((int)(a).size())
#define pb emplace_back
#define pf emplace_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define ins emplace
using namespace std;
const int MOD = 1e9+7, MAXN = 1e5+5;
const string NAME = "";
pair<ll,bool> val[1005][1005];
void preprocess(int l, int r, int a[]){
    if(l==r) return;
    int mid=(l+r)>>1;
    preprocess(l,mid,a);
    preprocess(mid+1,r,a);
    for(int i = mid-1; i>=l; --i)
        if(!val[i][mid].se) val[i][mid].fi=Secret(val[i+1][mid].fi,a[i]), val[i][mid].se=1;
    for(int i = mid+2; i<=r; ++i)
        if(!val[mid+1][i].se) val[mid+1][i].fi=Secret(val[mid+1][i-1].fi,a[i]), val[mid+1][i].se=1;
}
void Init(int n, int a[]){
    for(int i = 0; i<n; ++i)
        val[i][i].fi=a[i], val[i][i].se=1;
    preprocess(0,n-1,a);
}
int Query(int l, int r){
    if(val[l][r].se) return val[l][r].fi;
    for(int i = l; i<r; ++i)
        if(val[l][i].se&&val[i+1][r].se) return Secret(val[l][i].fi,val[i+1][r].fi);
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
   42 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 85 ms 12872 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 21318534.
2 Incorrect 77 ms 12872 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 660121609.
3 Incorrect 83 ms 12912 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 226914560.
4 Incorrect 312 ms 19272 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 372424933.
5 Incorrect 330 ms 19272 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 342545472.
6 Incorrect 307 ms 10948 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 311571272.
7 Incorrect 309 ms 11112 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 228067345.
8 Incorrect 339 ms 19348 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 554933464.
9 Incorrect 306 ms 19284 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 404104646.
10 Incorrect 311 ms 19304 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 809568335.