답안 #499041

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499041 2021-12-27T06:10:48 Z IOI_champion_in_1980 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
1601 ms 6788 KB
#include <bits/stdc++.h>
#include <math.h>
typedef long long ll;
using namespace std;
ll i, j, t, a, n, m, b, c, d, f, g;
int x[1000100], y[1000100];
int main()
{
    ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n>>m;
	for (a=1; a<=n; a++) cin>>x[a];
	for (a=1; a<=m; a++)
	{
		int l, r, k;
		cin>>l>>r>>k;
		int gmax=INT_MIN, mmax=INT_MIN;
		int ans=1;
		for (b=r; b>=l; b--)
		{
//			cout<<x[b]<<" "<<mmax<<" "<<gmax<<endl;
			if (mmax<x[b])
			{
				if (mmax+x[b]>k)
				{
					ans=0;
					break;
				}
				if (x[b]>gmax)
				{
					if (x[b]+gmax>k)
					{
						ans=0;
						break;
					}
					gmax=x[b];
					mmax=INT_MIN;
					continue;
				}
				mmax=x[b];
//				cout<<mmax<<endl;
				continue;
			}
		}
		cout<<ans<<endl;
	}
}
/*

*/


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1601 ms 6708 KB Output is correct
2 Incorrect 1571 ms 6788 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 556 ms 1160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -