# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29535 | 2017-07-20T05:34:32 Z | 윤교준(#1243) | Lightning Conductor (POI11_pio) | C++11 | 1000 ms | 7880 KB |
#include <bits/stdc++.h> #define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15); #define pb push_back #define sz(V) ((int)(V).size()) #define allv(V) ((V).begin()),((V).end()) #define befv(V) ((V)[sz(V)-2]) #define sorv(V) sort(allv(V)) #define revv(V) reverse(allv(V)) #define univ(V) (V).erase(unique(allv(V)),(V).end()) #define rgiv(V,n) ((V)[((n)+sz(V))%sz(V)]) #define clv(V) (V).clear() #define upmax(a,b) (a)=max((a),(b)) #define INF (0x3f3f3f3f) #define MAXN (500005) using namespace std; typedef long long ll; typedef pair<int, int> pii; int SQ[MAXN]; int H[MAXN]; int P[MAXN]; int N; int main() { for(int i = 1; i <= 708; i++) { int s = (i-1)*(i-1) + 1, e = min(MAXN-1, i*i); for(int j = s; j <= e; j++) SQ[j] = i; } scanf("%d", &N); for(int i = 1; i <= N; i++) scanf("%d", &H[i]); for(int i = 1; i <= N; i++) { int &ret = P[i]; for(int j = 1; j <= N; j++) upmax(ret, H[j] + SQ[abs(i-j)] - H[i]); } for(int i = 1; i <= N; i++) printf("%d\n", P[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 7880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 7880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 7880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 7880 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |