제출 #329751

#제출 시각아이디문제언어결과실행 시간메모리
329751RainbowbunnyHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
0 ms364 KiB
#include <bits/stdc++.h>
using namespace std;

int n, m;
int w[1000005];

int main()
{
	freopen("Input.txt", "r", stdin);
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	{
		cin >> w[i];
	}
	for(int i = 1; i <= m; i++)
	{
		int l, r, x;
		cin >> l >> r >> x;
		bool ok = true;
		for(int j = l; j <= r; j++)
		{
			for(int k = j + 1; k <= r; k++)
			{
				if(w[j] > w[k] and (w[j] + w[k] > x))
				{
					ok = false;
				}
			}
		}
		if(ok)
		{
			cout << 1 << '\n';
		}
		else
		{
			cout << 0 << '\n';
		}
	}
}

컴파일 시 표준 에러 (stderr) 메시지

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  freopen("Input.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...