# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1081902 | 2024-08-30T12:42:50 Z | farica | Radio Towers (IOI22_towers) | C++17 | 4000 ms | 2000 KB |
#include "towers.h" #include <bits/stdc++.h> using namespace std; int n,sub1=1,idx=0; vector<int> h; void init(int N, vector<int> H) { n = N; for(auto x : H) h.push_back(x); int ok=1; for(int i=0; i<H.size()-1; i++) { if(ok and H[i] > H[i+1]) { ok=0; idx = i; } if(!ok and H[i] < H[i+1]) sub1=0; } } int max_towers(int L, int R, int D) { if(sub1) { if(idx > L and idx < R and (h[L]+D) <= h[idx] and (h[R]+D) <= h[idx]) return 2; else return 1; } vector<int> dp(n+1,1); int ans=0; for(int i=2; i<n; i++) { int maksInd=0; for(int j=i-1; j>=0; --j) { if(maksInd >= h[i]+D && maksInd >= h[j]+D) dp[i] = max(dp[i], dp[j] + 1); maksInd = max(maksInd, h[j]); } ans = max(ans,dp[i]); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 265 ms | 1196 KB | Output is correct |
2 | Correct | 556 ms | 2000 KB | Output is correct |
3 | Correct | 610 ms | 1700 KB | Output is correct |
4 | Correct | 559 ms | 1748 KB | Output is correct |
5 | Correct | 545 ms | 1748 KB | Output is correct |
6 | Correct | 538 ms | 1748 KB | Output is correct |
7 | Correct | 675 ms | 1748 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '13', found: '131' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '13', found: '131' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4034 ms | 1748 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4070 ms | 824 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '13', found: '131' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 265 ms | 1196 KB | Output is correct |
2 | Correct | 556 ms | 2000 KB | Output is correct |
3 | Correct | 610 ms | 1700 KB | Output is correct |
4 | Correct | 559 ms | 1748 KB | Output is correct |
5 | Correct | 545 ms | 1748 KB | Output is correct |
6 | Correct | 538 ms | 1748 KB | Output is correct |
7 | Correct | 675 ms | 1748 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Incorrect | 1 ms | 340 KB | 1st lines differ - on the 1st token, expected: '13', found: '131' |
12 | Halted | 0 ms | 0 KB | - |