Submission #123537

# Submission time Handle Problem Language Result Execution time Memory
123537 2019-07-01T14:36:18 Z MohamedAhmed04 Lightning Conductor (POI11_pio) C++14
27 / 100
1000 ms 7160 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 5e5 + 5 ;

int arr[MAX] ;
int n ;

int main()
{
	scanf("%d" , &n) ;
	for(int i = 0 ; i < n ; ++i)
		scanf("%d" , &arr[i]) ;
	for(int i = 0 ; i < n ; ++i)
	{
		int ans = 0 ;
		for(int j = 0 ; j < n ; ++j)
		{
			int x = ceil(sqrt(abs(i - j) * 1.00)) ;
			ans = max(ans , arr[j] - arr[i] + x) ;
		}
		cout<<ans<<"\n";
	}
	return 0 ;
}

Compilation message

pio.cpp: In function 'int main()':
pio.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d" , &n) ;
  ~~~~~^~~~~~~~~~~
pio.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &arr[i]) ;
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 892 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 1172 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 1252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 1784 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 3448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 5132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 7160 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 7160 KB Time limit exceeded
2 Halted 0 ms 0 KB -