# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960009 | 2024-04-09T12:55:24 Z | hariaakas646 | Lightning Conductor (POI11_pio) | C++14 | 865 ms | 14164 KB |
#include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, j, k) for (int i = j; i < k; i++) #define frange(i, j) forr(i, 0, j) #define all(cont) cont.begin(), cont.end() #define mp make_pair #define pb push_back #define f first #define s second typedef long long int lli; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<lli> vll; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vi> vvi; typedef map<int, int> mpii; typedef set<int> seti; typedef multiset<int> mseti; typedef long double ld; void usaco() { freopen("/media/hariaakash646/785EF1075EF0BF46/CompetitiveProgramming/input.in", "r", stdin); // freopen("problem.out", "w", stdout); } int main() { // usaco(); int n; scd(n); vi vec(n); frange(i, n) scd(vec[i]); vi val; for(int i=0; i*i+1<=n; i++) { val.pb(i); } vi out(n); int ma = 0; frange(i, n) { for(auto e : val) { if(i - (e*e+1) < 0) break; ma = max(ma, vec[i-(e*e+1)] + e+1); } out[i] = ma; } ma = 0; for(int i=n-1; i>=0; i--) { for(auto e : val) { if(i + (e*e+1) >= n) break; ma = max(ma, vec[i+(e*e+1)] + e + 1); } out[i] = max(out[i], ma); } frange(i, n) { printf("%d\n", max(0, out[i]-vec[i])); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 1088 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 1620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 1824 KB | Output is correct |
2 | Correct | 39 ms | 1104 KB | Output is correct |
3 | Correct | 40 ms | 1616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 76 ms | 2388 KB | Output is correct |
2 | Correct | 75 ms | 2408 KB | Output is correct |
3 | Correct | 78 ms | 2532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 258 ms | 5508 KB | Output is correct |
2 | Correct | 252 ms | 5000 KB | Output is correct |
3 | Correct | 259 ms | 5088 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 489 ms | 10224 KB | Output is correct |
2 | Correct | 487 ms | 8020 KB | Output is correct |
3 | Correct | 486 ms | 8540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 848 ms | 14164 KB | Output is correct |
2 | Correct | 856 ms | 11032 KB | Output is correct |
3 | Correct | 865 ms | 12100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 833 ms | 11528 KB | Output is correct |
2 | Correct | 842 ms | 11088 KB | Output is correct |
3 | Correct | 844 ms | 12096 KB | Output is correct |