Submission #158423

# Submission time Handle Problem Language Result Execution time Memory
158423 2019-10-17T03:02:13 Z luciocf Lightning Conductor (POI11_pio) C++14
Compilation error
0 ms 0 KB
nclude <bits/stdc++.h>
 
using namespace std;
 
const int maxn = 5e5+10;
const int maxl = 21;
 
int n;
int a[maxn];
 
int tab[maxn][maxl];
int lg[maxn];
 
void build(void)
{
	lg[1] = 0;
	for (int i = 2; i < maxn; i++)
		lg[i] = lg[i/2]+1;
 
	for (int i = 1; i <= n; i++)
		tab[i][0] = a[i];
 
	for (int j = 1; j < maxl; j++)
		for (int i = 1; i + (1<<j) <= n+1; i++)
			tab[i][j] = max(tab[i][j-1], tab[i+(1<<(j-1))][j-1]);
}
 
int mx(int l, int r)
{
	int j = lg[r-l+1];
 
	return max(tab[l][j],tab[r-(1<<j)+1][j]);
}
 
int main(void)
{
	scanf("%d", &n);
 
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
 
	build();
 
	for (int i = 1; i <= n; i++)
	{
		int k = 0;
 
		for (int d = 1; (d-1)*(d-1) <= i; d++)
		{
			int l = max(1, i - d*d);
			int r = min(i-1, i - d*d + 2*d - 2);
 
			if (l > r) continue;
 
			k = max(k, mx(l, r) + d);
		}
 
		for (int d = 1; (d-1)*(d-1) <= n-i; d++)
		{
			int l = max(i+1, d*d - 2*d + i + 2);
			int r = min(n, i + d*d);
 
			if (l > r) continue;
 
			k = max(k, mx(l, r) + d);
		}
 
		printf("%d\n", max(0, k-a[i]));
	}
}

Compilation message

pio.cpp:1:1: error: 'nclude' does not name a type
 nclude <bits/stdc++.h>
 ^~~~~~
pio.cpp: In function 'void build()':
pio.cpp:25:16: error: 'max' was not declared in this scope
    tab[i][j] = max(tab[i][j-1], tab[i+(1<<(j-1))][j-1]);
                ^~~
pio.cpp:25:16: note: suggested alternative: 'maxl'
    tab[i][j] = max(tab[i][j-1], tab[i+(1<<(j-1))][j-1]);
                ^~~
                maxl
pio.cpp: In function 'int mx(int, int)':
pio.cpp:32:9: error: 'max' was not declared in this scope
  return max(tab[l][j],tab[r-(1<<j)+1][j]);
         ^~~
pio.cpp:32:9: note: suggested alternative: 'mx'
  return max(tab[l][j],tab[r-(1<<j)+1][j]);
         ^~~
         mx
pio.cpp: In function 'int main()':
pio.cpp:37:2: error: 'scanf' was not declared in this scope
  scanf("%d", &n);
  ^~~~~
pio.cpp:50:12: error: 'max' was not declared in this scope
    int l = max(1, i - d*d);
            ^~~
pio.cpp:50:12: note: suggested alternative: 'mx'
    int l = max(1, i - d*d);
            ^~~
            mx
pio.cpp:51:12: error: 'min' was not declared in this scope
    int r = min(i-1, i - d*d + 2*d - 2);
            ^~~
pio.cpp:51:12: note: suggested alternative: 'main'
    int r = min(i-1, i - d*d + 2*d - 2);
            ^~~
            main
pio.cpp:60:12: error: 'max' was not declared in this scope
    int l = max(i+1, d*d - 2*d + i + 2);
            ^~~
pio.cpp:60:12: note: suggested alternative: 'mx'
    int l = max(i+1, d*d - 2*d + i + 2);
            ^~~
            mx
pio.cpp:61:12: error: 'min' was not declared in this scope
    int r = min(n, i + d*d);
            ^~~
pio.cpp:61:12: note: suggested alternative: 'main'
    int r = min(n, i + d*d);
            ^~~
            main
pio.cpp:68:18: error: 'max' was not declared in this scope
   printf("%d\n", max(0, k-a[i]));
                  ^~~
pio.cpp:68:18: note: suggested alternative: 'mx'
   printf("%d\n", max(0, k-a[i]));
                  ^~~
                  mx
pio.cpp:68:3: error: 'printf' was not declared in this scope
   printf("%d\n", max(0, k-a[i]));
   ^~~~~~
pio.cpp:68:3: note: suggested alternative: 'int'
   printf("%d\n", max(0, k-a[i]));
   ^~~~~~
   int