답안 #44708

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44708 2018-04-05T10:44:32 Z top34051 Worst Reporter 3 (JOI18_worst_reporter3) C++17
12 / 100
16 ms 656 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int maxn = 1e3 + 5;

int n,q;
ll dist[maxn];

int get(ll T, ll L) {
    int l = 1, r = n, mid, pos = 0;
    while(l<=r) {
        mid = (l+r)/2;
        if(-mid + (T/dist[mid])*dist[mid] >= L) {
            pos = mid;
            l = mid+1;
        }
        else r = mid-1;
    }
    return pos;
}

int main() {
    scanf("%d%d",&n,&q);
    dist[0] = 1;
    for(int i=1;i<=n;i++) {
        scanf("%lld",&dist[i]);
        dist[i] = (ll)ceil((double)dist[i]/dist[i-1]) * dist[i-1];
    }
    while(q--) {
        ll T, L, R; int res = 0;
        scanf("%lld%lld%lld",&T,&L,&R);
        for(int i=0;i<=n;i++) {
            ll temp = -i+(T/dist[i])*dist[i];
            if(L<=temp && temp<=R) res++;
        }
        printf("%d\n",res);
    }
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&q);
     ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&dist[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
worst_reporter3.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld",&T,&L,&R);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 356 KB Output is correct
2 Correct 15 ms 432 KB Output is correct
3 Correct 16 ms 432 KB Output is correct
4 Correct 15 ms 636 KB Output is correct
5 Correct 15 ms 656 KB Output is correct
6 Correct 16 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -