답안 #235284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235284 2020-05-27T15:01:27 Z Knps4422 Sparklers (JOI17_sparklers) C++14
50 / 100
139 ms 8320 KB
//#pns thut contains thragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/

#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define forn(x,y) for(int x = 1 ; x <= y ; ++x)
#define all(x) (x).begin(),(x).end()
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);


using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef complex<int> point;
const int nmax = 1005;
const ll linf = 1e18;
const ll mod = 998244353;
const int inf = INT_MAX;

int n, k;
double t;
double pos[nmax];
double dp[nmax][nmax];

bool check(double x ){
	forn(i,n)
		forn(ii,n)dp[i][ii] = -1;
	dp[k][k] = t;
	for(int len = 0 ; len < n ; len++){
		for(int l = 1; l <= n ; l++){
			int r = l + len;
			if(r < n)
			if( dp[l][r]*x*2 >= (pos[r+1] - pos[r]) ) dp[l][r+1] = max( dp[l][r+1] , dp[l][r] + t - (pos[r+1] - pos[r])/(x*2)); 
			if(l > 1 && r <= n)
			if( dp[l][r]*x*2 >= (pos[l] - pos[l-1]) ) dp[l-1][r] = max( dp[l-1][r] , dp[l][r] + t - (pos[l] - pos[l-1])/(x*2)); 
		}
	}
	return (dp[1][n] >= t);
}

int main(){
	fast;
	cin >> n >> k >> t;
	forn(i,n){
		cin >> pos[i];
	}
	if(pos[1] == pos[n]){cout << 0 << '\n';return 0;}
	int l = 1 , r = 1e9;
	while ( l < r){
		int mid = (l+r)>>1;
		if(check((double)mid)) r = mid;
		else l = mid+1;
	}
	cout << r << '\n';
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 62 ms 6268 KB Output is correct
23 Correct 36 ms 4864 KB Output is correct
24 Correct 54 ms 6144 KB Output is correct
25 Correct 116 ms 8312 KB Output is correct
26 Correct 113 ms 8288 KB Output is correct
27 Correct 124 ms 8312 KB Output is correct
28 Correct 111 ms 8192 KB Output is correct
29 Correct 115 ms 8192 KB Output is correct
30 Correct 116 ms 8312 KB Output is correct
31 Correct 113 ms 8192 KB Output is correct
32 Correct 114 ms 8280 KB Output is correct
33 Correct 117 ms 8192 KB Output is correct
34 Correct 114 ms 8312 KB Output is correct
35 Correct 126 ms 8320 KB Output is correct
36 Correct 139 ms 8192 KB Output is correct
37 Correct 118 ms 8316 KB Output is correct
38 Correct 121 ms 8192 KB Output is correct
39 Correct 119 ms 8192 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 62 ms 6268 KB Output is correct
23 Correct 36 ms 4864 KB Output is correct
24 Correct 54 ms 6144 KB Output is correct
25 Correct 116 ms 8312 KB Output is correct
26 Correct 113 ms 8288 KB Output is correct
27 Correct 124 ms 8312 KB Output is correct
28 Correct 111 ms 8192 KB Output is correct
29 Correct 115 ms 8192 KB Output is correct
30 Correct 116 ms 8312 KB Output is correct
31 Correct 113 ms 8192 KB Output is correct
32 Correct 114 ms 8280 KB Output is correct
33 Correct 117 ms 8192 KB Output is correct
34 Correct 114 ms 8312 KB Output is correct
35 Correct 126 ms 8320 KB Output is correct
36 Correct 139 ms 8192 KB Output is correct
37 Correct 118 ms 8316 KB Output is correct
38 Correct 121 ms 8192 KB Output is correct
39 Correct 119 ms 8192 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
41 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Halted 0 ms 0 KB -