답안 #762094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762094 2023-06-20T19:13:34 Z dzdzx Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
365 ms 12908 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int main() {
	int n,m;
	cin>>n>>m;
	int a[n+1];
	for (int i=1;i<=n;i++)cin>>a[i];
	vector <int> v;
	while (m--){
		int l,r,k;
		cin>>l>>r>>k;
		for (int i=l;i<=r;i++)v.pb(a[i]);
		sort(v.begin(),v.end());
		int mx=0,mn=INT_MAX;
		for (int i=0;i<v.size();i++)if (a[i+l]!=v[i])mx=max(mx,a[i+l]);
		for (int i=l;i<=r;i++)mn=min(mn,a[i]);
		if (k>=mx+mn)cout<<"1 \n";else cout<<"0 \n";
	}
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:16:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for (int i=0;i<v.size();i++)if (a[i+l]!=v[i])mx=max(mx,a[i+l]);
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 2 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 2 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 365 ms 12908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 21 ms 2632 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 2 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 2 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -