# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
124654 | Mtaylor | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 2019 ms | 10356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
const int MOD = 1000000007;
const int N = 1000005;
const double PI =4*atan(1);
const double eps = 1e-7;
ll n,q;
ll d[N];
ll l, r, t;
ll tab[N];
int main(){
//ios::sync_with_stdio(0);
//freopen("easy.txt","r",stdin);
cin >> n>> q;
ll res;
for(int i=0;i<n;i++)
scanf("%lld",&d[i]);
tab[0]=1;
for(int i=1;i<=n;i++){
if(tab[i-1]>=d[i]){
tab[i]=tab[i-1];
}else{
//cout << d[i]<< endl;
tab[i] = tab[i-1] * ((d[i-1]+tab[i-1]-1)/tab[i-1]);
}
}
while(q--){
ll x, y, t;
cin >> t >> x >> y;
ll l=0, r=n;
bool cond=0;
ll sghir=0;
ll kbir=0;
while(l<=r){
ll mid=(l+r)/2;
ll p = tab[mid]*(t/tab[mid]) -mid;
if(p>=x && p<=y){
r=mid-1;
sghir=mid;
cond=true;
}else if(p<x){
r=mid-1;
}else{
l=mid+1;
}
}
if(cond==0){
cout << 0 << endl;
continue;
}
l=sghir; r=n;
while(l<=r){
ll mid=(l+r)/2;
ll p = tab[mid]*(t/tab[mid]) -mid;
if(p>=x && p<=y){
l=mid+1;
kbir=mid;
}else if(p<x){
r=mid-1;
}else{
l=mid+1;
}
}
cout << kbir-sghir+1 << endl;
}
return 0;
}
컴파일 시 표준 에러 (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... |