Submission #102006

# Submission time Handle Problem Language Result Execution time Memory
102006 2019-03-21T13:08:04 Z Nicholas_Patrick Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 512 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 lo=0x0 , hi=0x20000000000, mi;
		while(true){
			if(checkPossibility(lo)<=b)break;
			lo++;
		}
		printf("%lld\n", lo);
	}else{
		
	}
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:28:22: warning: unused variable 'hi' [-Wunused-variable]
   long long lo=0x0 , hi=0x20000000000, mi;
                      ^~
sculpture.cpp:28:40: warning: unused variable 'mi' [-Wunused-variable]
   long long lo=0x0 , hi=0x20000000000, mi;
                                        ^~
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 2 ms 256 KB Output is correct
2 Correct 2 ms 256 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 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 10 ms 384 KB Output is correct
10 Correct 16 ms 400 KB Output is correct
11 Correct 41 ms 256 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Incorrect 3 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 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 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 8 ms 256 KB Output is correct
9 Correct 10 ms 384 KB Output is correct
10 Correct 25 ms 384 KB Output is correct
11 Correct 41 ms 356 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 2 ms 368 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 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 7 ms 256 KB Output is correct
9 Correct 10 ms 356 KB Output is correct
10 Correct 20 ms 256 KB Output is correct
11 Correct 42 ms 384 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 3 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Execution timed out 1070 ms 256 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 7 ms 256 KB Output is correct
9 Correct 14 ms 384 KB Output is correct
10 Correct 17 ms 256 KB Output is correct
11 Correct 45 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 2 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 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 8 ms 256 KB Output is correct
9 Correct 10 ms 384 KB Output is correct
10 Correct 16 ms 384 KB Output is correct
11 Correct 45 ms 384 KB Output is correct
12 Correct 5 ms 364 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Execution timed out 1073 ms 384 KB Time limit exceeded
15 Halted 0 ms 0 KB -