Submission #49387

# Submission time Handle Problem Language Result Execution time Memory
49387 2018-05-28T08:50:01 Z okaybody10 Worst Reporter 3 (JOI18_worst_reporter3) C++
100 / 100
1288 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[600000];
int n;
int bef(int t,int k)
{
    int l=0,r=n+1;
    while(l<r)
    {
        int mid=(l+r)/2;
        if(-mid+t/a[mid]*a[mid]>=k) l=mid+1;
        else r=mid;
    }
    return r;
}
int main()
{
    int q; scanf("%d %d",&n,&q);
    a[0]=1;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        a[i]=((a[i]-1)/a[i-1]+1)*a[i-1];
    }
    while(q--)
    {
        int t,i,j; scanf("%d %d %d",&t,&i,&j);
        printf("%d\n",bef(t,i)-bef(t,j+1));
    }
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:19:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int q; scanf("%d %d",&n,&q);
            ~~~~~^~~~~~~~~~~~~~~
worst_reporter3.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
         ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:28:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int t,i,j; scanf("%d %d %d",&t,&i,&j);
                    ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1145 ms 7524 KB Output is correct
2 Correct 1205 ms 23100 KB Output is correct
3 Correct 1288 ms 38656 KB Output is correct
4 Correct 1178 ms 54164 KB Output is correct
5 Correct 1182 ms 69572 KB Output is correct
6 Correct 1170 ms 85088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 85088 KB Output is correct
2 Correct 3 ms 85088 KB Output is correct
3 Correct 3 ms 85088 KB Output is correct
4 Correct 3 ms 85088 KB Output is correct
5 Correct 4 ms 85088 KB Output is correct
6 Correct 4 ms 85088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1145 ms 7524 KB Output is correct
2 Correct 1205 ms 23100 KB Output is correct
3 Correct 1288 ms 38656 KB Output is correct
4 Correct 1178 ms 54164 KB Output is correct
5 Correct 1182 ms 69572 KB Output is correct
6 Correct 1170 ms 85088 KB Output is correct
7 Correct 4 ms 85088 KB Output is correct
8 Correct 3 ms 85088 KB Output is correct
9 Correct 3 ms 85088 KB Output is correct
10 Correct 3 ms 85088 KB Output is correct
11 Correct 4 ms 85088 KB Output is correct
12 Correct 4 ms 85088 KB Output is correct
13 Correct 743 ms 99056 KB Output is correct
14 Correct 721 ms 115640 KB Output is correct
15 Correct 848 ms 130900 KB Output is correct
16 Correct 747 ms 146636 KB Output is correct
17 Correct 918 ms 166656 KB Output is correct
18 Correct 907 ms 185444 KB Output is correct
19 Correct 874 ms 204056 KB Output is correct
20 Correct 795 ms 222752 KB Output is correct
21 Correct 843 ms 241312 KB Output is correct
22 Correct 846 ms 259880 KB Output is correct
23 Correct 806 ms 262144 KB Output is correct
24 Correct 805 ms 262144 KB Output is correct
25 Correct 990 ms 262144 KB Output is correct
26 Correct 1000 ms 262144 KB Output is correct
27 Correct 848 ms 262144 KB Output is correct
28 Correct 838 ms 262144 KB Output is correct
29 Correct 842 ms 262144 KB Output is correct
30 Correct 893 ms 262144 KB Output is correct
31 Correct 1000 ms 262144 KB Output is correct
32 Correct 928 ms 262144 KB Output is correct
33 Correct 3 ms 262144 KB Output is correct