답안 #379268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
379268 2021-03-17T19:15:25 Z nafis_shifat Worst Reporter 3 (JOI18_worst_reporter3) C++11
12 / 100
2000 ms 9324 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
int main() {
	int n,q;
	cin >> n >> q;

	ll d[n + 1];

	for(int i = 1; i <= n; i++) cin >> d[i];

	ll jump[n + 2];
    jump[0] = 1;

    for(int i = 1; i <= n; i++) {
    	jump[i] = jump[i - 1] * ((d[i] + jump[i - 1] - 1) / jump[i - 1]);
    	
    }


	while(q--) {
		ll t,l,r;
		cin >> t >> l >> r;

		int ans = 0;
		for(int i = 1; i <= n; i++) {
			ll x = t / jump[i];
			ll p = -i + x * jump[i];
			if(p >= l && p <= r) ans++;
		}

		if(t >= l && t <= r) ans++;

		cout<<ans<<endl;
	}
	
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2078 ms 9324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
3 Correct 9 ms 364 KB Output is correct
4 Correct 9 ms 364 KB Output is correct
5 Correct 10 ms 364 KB Output is correct
6 Correct 10 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2078 ms 9324 KB Time limit exceeded
2 Halted 0 ms 0 KB -