| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 379269 | nafis_shifat | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 2063 ms | 24100 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
int main() {
int n,q;
cin >> n >> q;
ll d[n + 1];
for(int i = 1; i <= n; i++) cin >> d[i];
ll jump[n + 2];
jump[0] = 1;
for(int i = 1; i <= n; i++) {
jump[i] = jump[i - 1] * ((d[i] + jump[i - 1] - 1) / jump[i - 1]);
}
while(q--) {
ll t,l,r;
cin >> t >> l >> r;
int lo = 0;
int hi = n;
int upb = 1,lwb = -1;
while(lo <= hi) {
int mid = lo + hi >> 1;
ll x = t / jump[mid];
ll p = -mid + x * jump[mid];
if(p <= r) {
upb = mid;
hi = mid - 1;
} else {
lo = mid + 1;
}
}
lo = 0;
hi = n;
while(lo <= hi) {
int mid = lo + hi >> 1;
ll x = t / jump[mid];
ll p = -mid + x * jump[mid];
if(p >= l) {
lwb = mid;
lo = mid + 1;
} else {
hi = mid - 1;
}
}
int ans;
if(lwb < upb) ans = 0;
else ans = lwb - upb + 1;
cout<<ans<<endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
