답안 #627060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627060 2022-08-12T06:17:43 Z pooyashams Worst Reporter 3 (JOI18_worst_reporter3) C++14
19 / 100
577 ms 22892 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <iomanip>
#include <vector>
#include <bitset>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#define endl '\n'
#define X first
#define Y second

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int maxn = 5e5+10;

int D[maxn];
int T[maxn];

inline int get_at(int i, int t)
{
	return -i + ( (t/T[i]) * T[i] );
}

int n;

inline int bisect(int x, int t)
{
	int down = -1;
	int up = n+1;
	while(up-down > 1)
	{
		int mid = (up+down) / 2;
		if(get_at(mid, t) <= x)
			up = mid;
		else
			down = mid;
	}
	return up;
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int q; cin >> n >> q;
	for(int i = 1; i <= n; i++)
		cin >> D[i];
	T[0] = 1;
	for(int i = 1; i <= n; i++)
	{
		T[i] = ((D[i] + T[i-1] - 1) / T[i-1]) * T[i-1];
	}
	while(q--)
	{
		int t, l, r; cin >> t >> l >> r;
		int a = bisect(r, t);
		int b = bisect(l-1, t);
		cout << b-a << endl;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 577 ms 22584 KB Output is correct
2 Correct 511 ms 22716 KB Output is correct
3 Correct 501 ms 22568 KB Output is correct
4 Correct 509 ms 22636 KB Output is correct
5 Correct 510 ms 22612 KB Output is correct
6 Correct 511 ms 22892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 577 ms 22584 KB Output is correct
2 Correct 511 ms 22716 KB Output is correct
3 Correct 501 ms 22568 KB Output is correct
4 Correct 509 ms 22636 KB Output is correct
5 Correct 510 ms 22612 KB Output is correct
6 Correct 511 ms 22892 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Runtime error 53 ms 9396 KB Execution killed with signal 8
14 Halted 0 ms 0 KB -