답안 #737996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
737996 2023-05-08T04:39:52 Z anusha777 비밀 (JOI14_secret) C++14
30 / 100
493 ms 4444 KB
#include "secret.h"
#include <bits/stdc++.h>
#define fast 			ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL)
#define sz(x)			(int)((x).size())
#define pb				push_back
#define vi				vector<int>
#define vb				vector<bool>
#define vvb				vector<vb>
#define pi				pair<int,int>
#define vpi				vector<pi>
#define vvi				vector<vi>
#define vc				vector<char>
#define all(x)			x.begin(), x.end()
#define rall(x)			x.rbegin(), x.rend()
#define pbb()			pop_back()
#define f				first
#define s				second
#define ll				long long
//#define int				long long
#define ull				unsigned long long
#define line               cout<<"_____________________________"<<endl;
#define hash                cout<<"################"<<endl;
#define forr(i, a, b)      for(int i=a; i<b; i++)
using namespace std;
const int N=1e5+1, mod=1e9+7, inf=1e18+1;
vi a;
int n;
void Set(int x, int v, int i , int l, int r)
{
    if(r-l==1)
    {
        a[x]=v;
        return;
    }
    int m= (l+r)/2;
    if(i<m) Set(2*x+1, v, i, l , m);
    else Set(2*x+2, v, i, m , r);
    if(a[2*x+1]!=-1 and a[2*x+2]!=-1) a[x]= Secret(a[2*x+1], a[2*x+2]);
}
void Init(int m, int A[])
{
    n=1;
    while(n<m) n*=2;
    a.resize(2*n-1,-1);
    forr(i, 0, n) Set(0, A[i], i, 0, n);

}
int query(int x, int lx, int rx, int l, int r)
{
    if(l>=rx or lx>=r) return -1;
    if(lx>=l and rx<=r) return a[x];
    int mx= (lx+rx)/2;
    int v1= query(2*x+1, lx, mx, l, r), v2= query(2*x+2, mx, rx, l, r);
    if(v1!=-1 and v2!=-1) return Secret(v1, v2);
    if(v1==-1) return v2;
    return v1;
}
int Query(int l, int r)
{
    return query(0, 0, n, l, r+1);
}

Compilation message

secret.cpp:25:39: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   25 | const int N=1e5+1, mod=1e9+7, inf=1e18+1;
      |                                   ~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 157 ms 2252 KB Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14
2 Partially correct 160 ms 2300 KB Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14
3 Partially correct 157 ms 2360 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 14
4 Partially correct 456 ms 4364 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 15
5 Partially correct 461 ms 4176 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 14
6 Partially correct 413 ms 4384 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 4
7 Partially correct 493 ms 4276 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 16
8 Partially correct 476 ms 4444 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 16
9 Partially correct 469 ms 4280 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 15
10 Partially correct 475 ms 4276 KB Output is partially correct - number of calls to Secret by Init = 1023, maximum number of calls to Secret by Query = 16