# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
825128 | 2023-08-14T14:38:29 Z | alvingogo | 송신탑 (IOI22_towers) | C++17 | 651 ms | 1456 KB |
#include "towers.h" #include <bits/stdc++.h> #define fs first #define sc second #define p_q priority_queue using namespace std; vector<int> v; int mx; int n; void init(int N, vector<int> h) { v=h; n=N; mx=0; for(int i=1;i<n;i++){ if(v[i]>v[mx]){ mx=i; } } } int max_towers(int L, int R, int d) { if(L>=mx || R<=mx){ return 1; } int u=0; int a=0,b=0; if(mx!=0){ int l=0,r=mx-1; while(r>l){ int m=(l+r+1)/2; if(v[m]+d>v[mx]){ r=m-1; } else{ l=m; } } a=max(0,l-L+1); } if(mx+1!=n){ int l=mx+1,r=n-1; while(r>l){ int m=(l+r)/2; if(v[m]+d>v[mx]){ l=m+1; } else{ r=m; } } b=max(0,R-l+1); } if(a==0 || b==0){ return 1; } return 2; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 272 ms | 936 KB | Output is correct |
2 | Correct | 502 ms | 1444 KB | Output is correct |
3 | Correct | 651 ms | 1440 KB | Output is correct |
4 | Correct | 538 ms | 1440 KB | Output is correct |
5 | Correct | 575 ms | 1440 KB | Output is correct |
6 | Correct | 581 ms | 1360 KB | Output is correct |
7 | Correct | 460 ms | 1456 KB | Output is correct |
8 | Correct | 0 ms | 208 KB | Output is correct |
9 | Correct | 0 ms | 208 KB | Output is correct |
10 | Correct | 0 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | 1st lines differ - on the 1st token, expected: '13', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | 1st lines differ - on the 1st token, expected: '13', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 400 ms | 1452 KB | 1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 552 KB | 1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | 1st lines differ - on the 1st token, expected: '13', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 272 ms | 936 KB | Output is correct |
2 | Correct | 502 ms | 1444 KB | Output is correct |
3 | Correct | 651 ms | 1440 KB | Output is correct |
4 | Correct | 538 ms | 1440 KB | Output is correct |
5 | Correct | 575 ms | 1440 KB | Output is correct |
6 | Correct | 581 ms | 1360 KB | Output is correct |
7 | Correct | 460 ms | 1456 KB | Output is correct |
8 | Correct | 0 ms | 208 KB | Output is correct |
9 | Correct | 0 ms | 208 KB | Output is correct |
10 | Correct | 0 ms | 208 KB | Output is correct |
11 | Incorrect | 0 ms | 208 KB | 1st lines differ - on the 1st token, expected: '13', found: '1' |
12 | Halted | 0 ms | 0 KB | - |