Submission #649468

# Submission time Handle Problem Language Result Execution time Memory
649468 2022-10-10T09:04:25 Z mychecksedad Circus (Balkan15_CIRCUS) C++17
0 / 100
21 ms 1988 KB
#include "circus.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int X = 1e6;
#define pb push_back
ll dp[X];
vector<int> p;
void init(int N, int M, int P[]){
	for(int i = 0; i < N; ++i) p.pb(P[i]);
	p.pb(M);
	sort(p.begin(), p.end());
	dp[p.size() - 1] = 0;
	for(int i = p.size() - 2; i >= 0; --i){
		int l = i + 1, r = p.size() - 1, pos = p.size() - 1;
		while(l <= r){
			int m = (l+r)>>1;
			if(dp[m] <= p[m] - p[i]){
				pos = m;
				r = m - 1;
			}else l = m + 1;
		}
		dp[i] = p[pos] - p[i];
	}
}
int minLength(int D) {
	int l = 0, r = p.size() - 1, pos = p.size() - 1;
	while(l <= r){
		int m = (l+r)>>1;
		if(dp[m] <= p[m] - D){
			pos = m;
			r = m - 1;
		}else l = m + 1;
	}
	return p[pos] - D;
}

Compilation message

grader.cpp: In function 'int main()':
grader.cpp:14:12: warning: unused variable 'max_code' [-Wunused-variable]
   14 |  long long max_code;
      |            ^~~~~~~~
grader.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d", &P[i]);
      |   ~~~~~^~~~~~~~~~~~~
grader.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
grader.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf("%d", &d);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1988 KB Output isn't correct
2 Halted 0 ms 0 KB -