답안 #65532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65532 2018-08-07T21:21:34 Z reality 비밀 (JOI14_secret) C++17
0 / 100
672 ms 17124 KB
#include "secret.h"

#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}

const int NN = 1024;

int G[NN][NN];

int n;

void go(int l,int r) {
	if (l == r)
		return;
	int m = (l + r) / 2;
	go(l,m);
	go(m+1,r);
	for (int i = m;i >= l;--i)
		if (G[i][m + 1] == -1)
			G[i][m + 1] = Secret(G[i][i],G[i + 1][m + 1]);
	for (int i = m + 1;i <= r;++i)
		if (G[m][i] == -1) 
			G[m][i] = Secret(G[m][i - 1],G[i][i]);

}

void Init(int N, int A[]) {
	n = N;
	for (int i = 0;i < n;++i)
		for (int j = i + 1;j < n;++j)
			G[i][j] = -1;
	for (int i = 0;i < n;++i)
		G[i][i] = A[i];
	go(0,n - 1);
}

int Query(int L, int R) {
	if (G[L][R] != -1)
		return G[L][R];
	for (int k = L;k < R;++k)
		if (G[L][k] != -1 && G[k + 1][R] != -1)
			return Secret(G[L][k],G[k + 1][R]);
	assert(0);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 179 ms 8824 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 176 ms 8916 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 175 ms 9044 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 658 ms 17028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 632 ms 17028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Incorrect 629 ms 17028 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
7 Runtime error 639 ms 17028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 647 ms 17028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 651 ms 17028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 672 ms 17124 KB Execution killed with signal 11 (could be triggered by violating memory limits)