Submission #94166

# Submission time Handle Problem Language Result Execution time Memory
94166 2019-01-16T12:13:04 Z autumn_eel Worst Reporter 3 (JOI18_worst_reporter3) C++14
100 / 100
1109 ms 29304 KB
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int n;
ll d[600000];
ll a[600000];//cycle

int calc(ll x,ll T){
	ll l=-1,r=n+1;
	while(r-l>1){
		int t=(l+r)/2;
		if(-t+(T/a[t])*a[t]>=x)l=t;
		else r=t;
	}
	return r;
}

int main(){
	int q;scanf("%d%d",&n,&q);
	rep(i,n)scanf("%lld",&d[i+1]);
	a[0]=1;
	for(int i=1;i<=n;i++){
		ll t=(d[i]+a[i-1]-1)/a[i-1];
		a[i]=t*a[i-1];
	}
	rep(i,q){
		ll t,l,r;scanf("%lld%lld%lld",&t,&l,&r);
		printf("%d\n",calc(l,t)-calc(r+1,t));
	}
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:25:13: 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:26:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  rep(i,n)scanf("%lld",&d[i+1]);
          ~~~~~^~~~~~~~~~~~~~~~
worst_reporter3.cpp:33:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   ll t,l,r;scanf("%lld%lld%lld",&t,&l,&r);
            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1109 ms 26804 KB Output is correct
2 Correct 1104 ms 26716 KB Output is correct
3 Correct 1106 ms 26608 KB Output is correct
4 Correct 1041 ms 26744 KB Output is correct
5 Correct 1073 ms 26616 KB Output is correct
6 Correct 1079 ms 26616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 380 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1109 ms 26804 KB Output is correct
2 Correct 1104 ms 26716 KB Output is correct
3 Correct 1106 ms 26608 KB Output is correct
4 Correct 1041 ms 26744 KB Output is correct
5 Correct 1073 ms 26616 KB Output is correct
6 Correct 1079 ms 26616 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 680 ms 25284 KB Output is correct
14 Correct 676 ms 25976 KB Output is correct
15 Correct 731 ms 24568 KB Output is correct
16 Correct 662 ms 25000 KB Output is correct
17 Correct 818 ms 29304 KB Output is correct
18 Correct 804 ms 29248 KB Output is correct
19 Correct 809 ms 29292 KB Output is correct
20 Correct 811 ms 29160 KB Output is correct
21 Correct 814 ms 29304 KB Output is correct
22 Correct 761 ms 29176 KB Output is correct
23 Correct 1049 ms 29284 KB Output is correct
24 Correct 764 ms 29296 KB Output is correct
25 Correct 1057 ms 26732 KB Output is correct
26 Correct 1010 ms 26660 KB Output is correct
27 Correct 837 ms 28960 KB Output is correct
28 Correct 800 ms 29256 KB Output is correct
29 Correct 790 ms 28668 KB Output is correct
30 Correct 907 ms 28756 KB Output is correct
31 Correct 843 ms 28920 KB Output is correct
32 Correct 774 ms 25196 KB Output is correct
33 Correct 2 ms 252 KB Output is correct