Submission #498598

# Submission time Handle Problem Language Result Execution time Memory
498598 2021-12-25T15:49:43 Z Ziyoda Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
701 ms 22100 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	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(b>ki)
						break;	}
			}
			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;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 673 ms 22100 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 701 ms 2104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -