# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242213 | SomeoneUnknown | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 792 ms | 5624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int posof(int slow, int id, int tiem){
//printf("%d at pos %d at time %d\n", id, (tiem/slow)*slow-id, tiem);
return (tiem/slow)*slow-id;
}
int main(){
int n, q;
scanf("%d %d", &n, &q);
int dancers[n+1];
dancers[0] = 1;
for(int i = 0; i < n; ++i){
scanf("%d", &dancers[i+1]);
--dancers[i+1];
dancers[i+1] /= dancers[i];
++dancers[i+1];
dancers[i+1] *= dancers[i];
}
for(int i = 0; i < q; ++i){
int t,s,e;
scanf("%d %d %d", &t, &s, &e);
++e;
int lo, hi;
//Find how many dancers are after the end
lo = -1;
hi = n+1;
int mid;
while(hi-lo>1){
mid = (hi+lo)/2;
if(posof(dancers[mid],mid,t) < e){
hi = mid;
}else{
lo = mid;
}
}
e = hi;
//Find how many dancers are after the start
lo = -1;
hi = n+1;
while(hi-lo>1){
mid = (hi+lo)/2;
if(posof(dancers[mid],mid,t) < s){
hi = mid;
}else{
lo = mid;
}
}
s = hi;
printf("%d\n",s-e);
}
}
/*
3 6
2
5
3
1 2 4
2 2 4
3 2 4
4 2 4
5 2 4
6 2 4
*/
컴파일 시 표준 에러 (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... |