답안 #62331

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62331 2018-07-28T06:03:21 Z gusfring Worst Reporter 3 (JOI18_worst_reporter3) C++14
19 / 100
958 ms 263168 KB
#include <cstdio>
 
int n;
int a[500005];
 
inline int f(int T, int X) {
	int L, R, M;
	L = 0;
	R = n + 1;
	while (L < R) {
		M = L + R >> 1;
		if (T / a[M] * a[M] - M >= X) L = M + 1;
		else R = M;
	}
	return L;
}
 
int main() {
	int i, j, k, m;
	scanf("%d%d", &n, &m);
	a[0] = 1;
	for (i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		a[i] = ((a[i] - 1) / a[i - 1] + 1) * a[i - 1];
	}
	while (m--) {
		scanf("%d%d%d", &i, &j, &k);
		printf("%d\n", f(i, j) - f(i, k + 1));
	}
}

Compilation message

worst_reporter3.cpp: In function 'int f(int, int)':
worst_reporter3.cpp:11:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   M = L + R >> 1;
       ~~^~~
worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
worst_reporter3.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
worst_reporter3.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &i, &j, &k);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 908 ms 20740 KB Output is correct
2 Correct 958 ms 36232 KB Output is correct
3 Correct 897 ms 51880 KB Output is correct
4 Correct 881 ms 67456 KB Output is correct
5 Correct 883 ms 82920 KB Output is correct
6 Correct 850 ms 98308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 98308 KB Output is correct
2 Correct 5 ms 98308 KB Output is correct
3 Correct 3 ms 98308 KB Output is correct
4 Correct 4 ms 98308 KB Output is correct
5 Correct 3 ms 98308 KB Output is correct
6 Correct 4 ms 98308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 908 ms 20740 KB Output is correct
2 Correct 958 ms 36232 KB Output is correct
3 Correct 897 ms 51880 KB Output is correct
4 Correct 881 ms 67456 KB Output is correct
5 Correct 883 ms 82920 KB Output is correct
6 Correct 850 ms 98308 KB Output is correct
7 Correct 5 ms 98308 KB Output is correct
8 Correct 5 ms 98308 KB Output is correct
9 Correct 3 ms 98308 KB Output is correct
10 Correct 4 ms 98308 KB Output is correct
11 Correct 3 ms 98308 KB Output is correct
12 Correct 4 ms 98308 KB Output is correct
13 Correct 555 ms 112632 KB Output is correct
14 Correct 582 ms 129156 KB Output is correct
15 Correct 555 ms 144352 KB Output is correct
16 Correct 543 ms 160156 KB Output is correct
17 Correct 838 ms 180180 KB Output is correct
18 Correct 768 ms 198820 KB Output is correct
19 Correct 747 ms 217548 KB Output is correct
20 Correct 760 ms 236164 KB Output is correct
21 Correct 740 ms 254936 KB Output is correct
22 Runtime error 696 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 -