Submission #81877

# Submission time Handle Problem Language Result Execution time Memory
81877 2018-10-27T14:19:58 Z Pajaraja Worst Reporter 3 (JOI18_worst_reporter3) C++17
100 / 100
864 ms 192668 KB
#include <bits/stdc++.h>
#define MAXN 500007
using namespace std;
int sk[MAXN],d[MAXN];
int bin(int l,int r,int p,int t)
{
	if(l==r) return l;
	int s=(l+r)/2;
	if((t/sk[s])*sk[s]-s<=p) return bin(l,s,p,t);
	return bin(s+1,r,p,t);
}
int main()
{
	int n,q;
	scanf("%d%d",&n,&q);
	sk[0]=1; sk[n+1]=2000000000;
	for(int i=1;i<=n;i++) scanf("%d",&d[i]);
	for(int i=1;i<=n;i++) sk[i]=((d[i]-1)/sk[i-1]+1)*sk[i-1];
	for(int i=0;i<q;i++)
	{
		int t,l,r;
		scanf("%d%d%d",&t,&l,&r);
		printf("%d\n",-bin(0,n+1,r,t)+bin(0,n+1,l-1,t));
	}
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:15:7: 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:17:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",&d[i]);
                        ~~~~~^~~~~~~~~~~~
worst_reporter3.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d",&t,&l,&r);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 864 ms 22392 KB Output is correct
2 Correct 786 ms 22560 KB Output is correct
3 Correct 737 ms 22560 KB Output is correct
4 Correct 720 ms 22560 KB Output is correct
5 Correct 739 ms 22560 KB Output is correct
6 Correct 698 ms 22560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 22560 KB Output is correct
2 Correct 3 ms 22560 KB Output is correct
3 Correct 3 ms 22560 KB Output is correct
4 Correct 3 ms 22560 KB Output is correct
5 Correct 3 ms 22560 KB Output is correct
6 Correct 3 ms 22560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 864 ms 22392 KB Output is correct
2 Correct 786 ms 22560 KB Output is correct
3 Correct 737 ms 22560 KB Output is correct
4 Correct 720 ms 22560 KB Output is correct
5 Correct 739 ms 22560 KB Output is correct
6 Correct 698 ms 22560 KB Output is correct
7 Correct 4 ms 22560 KB Output is correct
8 Correct 3 ms 22560 KB Output is correct
9 Correct 3 ms 22560 KB Output is correct
10 Correct 3 ms 22560 KB Output is correct
11 Correct 3 ms 22560 KB Output is correct
12 Correct 3 ms 22560 KB Output is correct
13 Correct 511 ms 22560 KB Output is correct
14 Correct 494 ms 22560 KB Output is correct
15 Correct 472 ms 22560 KB Output is correct
16 Correct 490 ms 22560 KB Output is correct
17 Correct 678 ms 22560 KB Output is correct
18 Correct 676 ms 22560 KB Output is correct
19 Correct 664 ms 22560 KB Output is correct
20 Correct 643 ms 22560 KB Output is correct
21 Correct 648 ms 22560 KB Output is correct
22 Correct 623 ms 22560 KB Output is correct
23 Correct 646 ms 40444 KB Output is correct
24 Correct 634 ms 59380 KB Output is correct
25 Correct 723 ms 75180 KB Output is correct
26 Correct 782 ms 90792 KB Output is correct
27 Correct 732 ms 108324 KB Output is correct
28 Correct 680 ms 126572 KB Output is correct
29 Correct 665 ms 144100 KB Output is correct
30 Correct 716 ms 161568 KB Output is correct
31 Correct 679 ms 178180 KB Output is correct
32 Correct 558 ms 192668 KB Output is correct
33 Correct 2 ms 192668 KB Output is correct