Submission #102009

# Submission time Handle Problem Language Result Execution time Memory
102009 2019-03-21T13:29:27 Z Nicholas_Patrick Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

int n, a, b;
vector <long long> y, psy;
int checkPossibility(long long x, long long toDeduct=0, int checkFrom=0){
	if(checkFrom==n)
		return 0;
	int ret=n;
	for(int i = checkFrom;i < n;i ++){
		if(((psy[i]-toDeduct)|x)==x)
			ret=min(ret, checkPossibility(x, psy[i], i+1));
		if(psy[i]-toDeduct>x)
			break;
	}
	return ret+1;
}
int main(){
	scanf("%d %d %d", &n, &a, &b);
	y.resize(n);
	psy.resize(n);
	for(int i = 0;i < n;i ++)
		scanf("%lld", &y[i]);
	psy[0]=y[0];
	for(int i = 1;i < n;i ++)
		psy[i]=psy[i-1]+y[i];
	if(a==1){
		long long check=0x1FFFFFFFFFF;
		for(int i = 40;i >= 0;i --){
			if(checkPossibility(check-(1ll<<i))<=b){
				check-=1ll<<i;
			}
		}
		printf("%lld\n", check);
	}else{

	}
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &y[i]);
   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 45 ms 256 KB Output is correct
8 Correct 297 ms 256 KB Output is correct
9 Correct 283 ms 476 KB Output is correct
10 Correct 290 ms 376 KB Output is correct
11 Correct 303 ms 376 KB Output is correct
12 Correct 284 ms 384 KB Output is correct
13 Correct 321 ms 384 KB Output is correct
14 Incorrect 2 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 53 ms 384 KB Output is correct
8 Correct 318 ms 384 KB Output is correct
9 Correct 325 ms 384 KB Output is correct
10 Correct 309 ms 356 KB Output is correct
11 Correct 323 ms 504 KB Output is correct
12 Correct 315 ms 384 KB Output is correct
13 Correct 289 ms 476 KB Output is correct
14 Incorrect 2 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 16 ms 256 KB Output is correct
7 Correct 39 ms 384 KB Output is correct
8 Correct 289 ms 352 KB Output is correct
9 Correct 356 ms 384 KB Output is correct
10 Correct 311 ms 384 KB Output is correct
11 Correct 334 ms 476 KB Output is correct
12 Correct 325 ms 384 KB Output is correct
13 Correct 319 ms 376 KB Output is correct
14 Correct 635 ms 376 KB Output is correct
15 Execution timed out 1069 ms 384 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 16 ms 392 KB Output is correct
7 Correct 37 ms 372 KB Output is correct
8 Correct 289 ms 356 KB Output is correct
9 Correct 263 ms 380 KB Output is correct
10 Correct 253 ms 256 KB Output is correct
11 Correct 256 ms 384 KB Output is correct
12 Correct 322 ms 424 KB Output is correct
13 Correct 329 ms 384 KB Output is correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 37 ms 384 KB Output is correct
8 Correct 318 ms 376 KB Output is correct
9 Correct 366 ms 256 KB Output is correct
10 Correct 317 ms 248 KB Output is correct
11 Correct 303 ms 504 KB Output is correct
12 Correct 354 ms 384 KB Output is correct
13 Correct 301 ms 504 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 37 ms 384 KB Output is correct
18 Correct 63 ms 256 KB Output is correct
19 Correct 71 ms 384 KB Output is correct
20 Correct 121 ms 384 KB Output is correct
21 Correct 118 ms 504 KB Output is correct
22 Correct 181 ms 360 KB Output is correct
23 Correct 175 ms 256 KB Output is correct
24 Correct 567 ms 476 KB Output is correct
25 Execution timed out 1078 ms 256 KB Time limit exceeded
26 Halted 0 ms 0 KB -