답안 #762095

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762095 2023-06-20T19:17:51 Z dzdzx Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 11756 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];
	
	while (m--){
		int l,r,k;
		cin>>l>>r>>k;
		vector <int> v;
		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:17:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for (int i=0;i<v.size();i++)if (a[i+l]!=v[i])mx=max(mx,a[i+l]);
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3048 ms 11756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3060 ms 1632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -