Submission #81876

# Submission time Handle Problem Language Result Execution time Memory
81876 2018-10-27T14:19:20 Z Pajaraja Worst Reporter 3 (JOI18_worst_reporter3) C++17
19 / 100
827 ms 263168 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 706 ms 22796 KB Output is correct
2 Correct 692 ms 38244 KB Output is correct
3 Correct 725 ms 53780 KB Output is correct
4 Correct 711 ms 69344 KB Output is correct
5 Correct 827 ms 84676 KB Output is correct
6 Correct 710 ms 100208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 100208 KB Output is correct
2 Correct 3 ms 100208 KB Output is correct
3 Correct 2 ms 100208 KB Output is correct
4 Correct 3 ms 100208 KB Output is correct
5 Correct 3 ms 100208 KB Output is correct
6 Correct 3 ms 100208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 706 ms 22796 KB Output is correct
2 Correct 692 ms 38244 KB Output is correct
3 Correct 725 ms 53780 KB Output is correct
4 Correct 711 ms 69344 KB Output is correct
5 Correct 827 ms 84676 KB Output is correct
6 Correct 710 ms 100208 KB Output is correct
7 Correct 3 ms 100208 KB Output is correct
8 Correct 3 ms 100208 KB Output is correct
9 Correct 2 ms 100208 KB Output is correct
10 Correct 3 ms 100208 KB Output is correct
11 Correct 3 ms 100208 KB Output is correct
12 Correct 3 ms 100208 KB Output is correct
13 Correct 490 ms 114432 KB Output is correct
14 Correct 513 ms 131060 KB Output is correct
15 Correct 473 ms 146224 KB Output is correct
16 Correct 486 ms 161976 KB Output is correct
17 Correct 680 ms 182120 KB Output is correct
18 Correct 609 ms 200636 KB Output is correct
19 Correct 587 ms 219244 KB Output is correct
20 Correct 622 ms 238012 KB Output is correct
21 Correct 590 ms 256592 KB Output is correct
22 Runtime error 655 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
23 Halted 0 ms 0 KB -