제출 #169464

#제출 시각아이디문제언어결과실행 시간메모리
169464abilHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
13 / 100
757 ms42208 KiB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define all(s) s.begin(),s.end()
//#define int long long

using namespace std;

const int N = (1e6 + 12);
const int mod = (1e9 + 7);
const int INF = (0x3f3f3f3f);

int a[N], mx[N];
main()
{
	int n, m, pos;
	scanf("%d%d", &n, &m);
	a[0] = INF;
	for(int i = 1;i <= n; i++){
		scanf("%d", &a[i]);
		if(a[i] < a[i - 1]){
			pos = i;
		}
		mx[i] = pos;
	}
	int l, r, k;
	while(m--){
		scanf("%d%d%d", &l, &r, &k);
		if(mx[r] <= l){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
	}
	  
}

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

sortbooks.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
sortbooks.cpp: In function 'int main()':
sortbooks.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
sortbooks.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
sortbooks.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &l, &r, &k);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:27:9: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   mx[i] = pos;
   ~~~~~~^~~~~
#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...