Submission #497568

# Submission time Handle Problem Language Result Execution time Memory
497568 2021-12-23T09:52:51 Z Nuraly_Serikbay Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
13 / 100
541 ms 25924 KB
/*	Speech to the young  */

#include <bits/stdc++.h>
 
#define endl "\n"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz size()
#define rep(i,k,n) for(int i = k ; i <= n ; ++i)
#define per(i,k,n) for(int i = k ; i >= n ; --i)
#define Zymraq() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define toqta return 0
#define PERMUTE next_permutation
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;

 
using namespace std;

#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse,-fgcse-lm")
#pragma GCC optimize("-ftree-pre,-ftree-vrp")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")

  
typedef long long ull;
typedef unsigned long long ll;
typedef string S;
typedef double D;
  
const int N = 1e6 + 17;
const int modd = 1e9 + 7;
const int INF = 2e9 - 19;
const int P = 37;
const ll NN = 1e7 + 17;
const D eps = 1e-19;
const double pi = 3.141592653589793238462643383279 ;
  
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){
    return (a.second < b.second);
}

void pre (ll a) {
    cout << fixed << setprecision(a);
    return;
} 

ll n, q, a[N], pref[N];
ll b[N];

void Solutions () {
	cin >> n >> q;
	for (int i = 1; i <= n; ++ i) {
		cin >> a[i];
	}
	for (int i = 1; i < n; ++ i) {
		if (a[i] > a[i + 1]) b[i] = 1;
		pref[i] = pref[i - 1] + b[i];
	}
	pref[n] = pref[n - 1];
	while (q --) {
		ll l, r, k;
		cin >> l >> r >> k;
		if (pref[r - 1] - pref[l - 1] == 0) cout << 1 << '\n';
		else cout << 0 << '\n';
	}
	return;
}

int main(){
	Zymraq();
	Solutions ();
	exit (0);
}

Compilation message

sortbooks.cpp: In function 'void Solutions()':
sortbooks.cpp:63:20: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   63 |  for (int i = 1; i <= n; ++ i) {
      |                  ~~^~~~
sortbooks.cpp:66:20: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   66 |  for (int i = 1; i < n; ++ i) {
      |                  ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 511 ms 25824 KB Output is correct
2 Correct 500 ms 25920 KB Output is correct
3 Correct 541 ms 25800 KB Output is correct
4 Correct 495 ms 25924 KB Output is correct
5 Correct 486 ms 18128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 2884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -