# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242200 | dwsc | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 705 ms | 22888 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,q;
cin >> n >> q;
int arr[n+1];
arr[0] = 1;
for (int i = 1; i <= n; i++){
cin >> arr[i];
arr[i] = ((arr[i]+arr[i-1]-1)/arr[i-1])*arr[i-1];
//cout << arr[i] << "\n";
}
for (int i = 0; i < q; i++){
int l,r,t;
cin >> t>> l >> r;
int lo1 = 0,hi1 = n+1;
int ans1 = -1;
while (lo1 != hi1){
int m = (lo1+hi1)/2;
int travel = (t/arr[m])*arr[m];
int newcoord = -m+travel;
if (newcoord <= r){
hi1 = m;
ans1 = m;
}
else{
lo1 = m+1;
}
}
int lo2 = 0,hi2 = n+1;
int ans2 = -1;
while (lo2 != hi2){
int m = (lo2+hi2)/2;
int travel = (t/arr[m])*arr[m];
int newcoord = -m+travel;
if (newcoord >= l){
lo2 = m+1;
ans2 = m;
}
else{
hi2 = m;
}
}
// cout << ans1 << " " << ans2 << "hi\n";
cout << max(ans2-ans1+1,0LL) << "\n";
}
}
컴파일 시 표준 에러 (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... |