Submission #1056331

# Submission time Handle Problem Language Result Execution time Memory
1056331 2024-08-13T08:54:07 Z Minbaev Secret (JOI14_secret) C++17
0 / 100
266 ms 4180 KB
#include "secret.h"

using namespace std;

const int Y = 1005;

int t[Y*4], a[Y], n;

void build(int tl, int tr, int v){
	if(tl == tr){
		t[v] = a[tl];
		return;
	}
	int tm = tr + tl >> 1;
	
	build(tl,tm,v << 1);
	build(tm+1,tr,v << 1 | 1);
	t[v] = Secret(t[v << 1], t[v >> 1 | 1]);
}
 
int get(int tl, int tr, int v, int l, int r){
	if(l <= tl && tr <= r){
		return t[v];
	}
	int tm = tr + tl >> 1;
	
	if(tm < l)return get(tm+1,tr,v << 1 | 1,l,r);
	if(tm + 1 > r)return get(tl,tm,v << 1,l,r);
	
	return Secret(get(tm+1,tr,v << 1 | 1,l,r), get(tl,tm,v << 1,l,r));
}

void Init(int N, int A[]){
    n = N;
    for(int i = 0; i < n; ++i) a[i] = A[i];
    build(0, n - 1, 1);
 
}
int Query(int l, int r){
    return get(0, n - 1, 1, l, r);
}

Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:14:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   14 |  int tm = tr + tl >> 1;
      |           ~~~^~~~
secret.cpp: In function 'int get(int, int, int, int, int)':
secret.cpp:25:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |  int tm = tr + tl >> 1;
      |           ~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 3632 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 54682451.
2 Incorrect 87 ms 3440 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 288496073.
3 Incorrect 64 ms 3668 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 354887992.
4 Incorrect 247 ms 4176 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 563675148.
5 Incorrect 245 ms 4176 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 146311448.
6 Incorrect 266 ms 4180 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 271689568.
7 Incorrect 257 ms 4176 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 655497299.
8 Incorrect 250 ms 4176 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 165761048.
9 Incorrect 250 ms 4180 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 142742499.
10 Incorrect 247 ms 4180 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 340642315.