# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1081929 | 2024-08-30T12:59:44 Z | farica | 송신탑 (IOI22_towers) | C++17 | 4000 ms | 5532 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) { h.clear(); sub1 = 1; 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; } int ans=0; set<int>s; map<int,int>m; s.insert(max(h[L],h[L+1])); m[max(h[L], h[L+1])] = 1; for(int i=L+2; i<=R; i++) { auto it = s.lower_bound(h[i]+D); ans = max(ans, m[*it]+1); m[h[i]] = m[*it] + 1; while(!s.empty() && *(s.begin()) < h[i]) s.erase(s.begin()); s.insert(h[i]); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 307 ms | 1236 KB | Output is correct |
2 | Correct | 605 ms | 1748 KB | Output is correct |
3 | Correct | 609 ms | 1748 KB | Output is correct |
4 | Correct | 615 ms | 1748 KB | Output is correct |
5 | Correct | 635 ms | 1748 KB | Output is correct |
6 | Correct | 618 ms | 1748 KB | Output is correct |
7 | Correct | 645 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '13', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '13', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4010 ms | 5532 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4094 ms | 1624 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '13', found: '5' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 307 ms | 1236 KB | Output is correct |
2 | Correct | 605 ms | 1748 KB | Output is correct |
3 | Correct | 609 ms | 1748 KB | Output is correct |
4 | Correct | 615 ms | 1748 KB | Output is correct |
5 | Correct | 635 ms | 1748 KB | Output is correct |
6 | Correct | 618 ms | 1748 KB | Output is correct |
7 | Correct | 645 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 | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '13', found: '5' |
12 | Halted | 0 ms | 0 KB | - |