답안 #498678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498678 2021-12-26T06:13:06 Z Ziyoda Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 14440 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void solve(){
	int n, m;
	cin >> n >> m;
	long long a[n+1], b, mx=0, li, ri, ki;
	for(int i=1; i<=n; i++)
		cin >> a[i];
	for(int i=1; i<=m; i++){
		bool y=0;
		b = 0;
		cin >> li >> ri >> ki;
		for(int e=li; e<=ri; e++){
			if(b<a[e]){
				if(b+mx>ki)
					break;
				mx = 0;
				if(e!=ri && a[e]>a[e+1]){
					y=1; b=a[e];	}
			}
			if(y && a[e]<b)
				mx = max(a[e], mx);
		}
		//cout << b << ' ' << mx << "\n";
		if(b+mx>ki)
			cout << 0 << "\n";
		else
			cout << 1 << "\n";
		mx = 0;
	}
}

int main()
{
	int t=1;
	//cin >> t;
	while(t--){
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 8 ms 372 KB Output is correct
12 Correct 9 ms 412 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 13 ms 476 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 33 ms 440 KB Output is correct
17 Correct 24 ms 412 KB Output is correct
18 Correct 34 ms 404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2768 ms 10104 KB Output is correct
2 Correct 2804 ms 14404 KB Output is correct
3 Correct 2786 ms 14440 KB Output is correct
4 Correct 2786 ms 14420 KB Output is correct
5 Execution timed out 3089 ms 12508 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 1014 ms 1348 KB Output is correct
2 Correct 2866 ms 3188 KB Output is correct
3 Execution timed out 3012 ms 2644 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 8 ms 372 KB Output is correct
12 Correct 9 ms 412 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 13 ms 476 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 33 ms 440 KB Output is correct
17 Correct 24 ms 412 KB Output is correct
18 Correct 34 ms 404 KB Output is correct
19 Correct 2784 ms 8756 KB Output is correct
20 Correct 2853 ms 8872 KB Output is correct
21 Execution timed out 3024 ms 5600 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 8 ms 372 KB Output is correct
12 Correct 9 ms 412 KB Output is correct
13 Correct 10 ms 408 KB Output is correct
14 Correct 13 ms 476 KB Output is correct
15 Correct 13 ms 460 KB Output is correct
16 Correct 33 ms 440 KB Output is correct
17 Correct 24 ms 412 KB Output is correct
18 Correct 34 ms 404 KB Output is correct
19 Correct 2768 ms 10104 KB Output is correct
20 Correct 2804 ms 14404 KB Output is correct
21 Correct 2786 ms 14440 KB Output is correct
22 Correct 2786 ms 14420 KB Output is correct
23 Execution timed out 3089 ms 12508 KB Time limit exceeded