이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/********************************** //deque,priority_queue
* author: NurkhatKrutoi2009
* created: Just now
* P.S: tourist ne katai
**********************************/
#include <bits/stdc++.h>
/* for ordered_set <int> st; --> st.order_of_key(j)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds; //Delete the other one
template<class T> using ordered_set = tree<T, null_type,
less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>,
rb_tree_tag, tree_order_statistics_node_update>;
*//*
#include <algorithm>
#include <iostream>
#include <cmath>
*//*
#pragma GCC optimize("fast-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2,fma")
#pragma GCC optimization ("unroll-loops")
*/
#define int long long
#define FREOPEN freopen(" .in", "r", stdin); freopen(" .out", "w", stdout);
#define sonic ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FORR( i, x, n, d ) for( int i = x; i >= n; i -= d )
#define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
#define all(x) (x).begin(), (x).end()
#define pss pair<string,string>
#define nextp next_permutation
#define pii pair<int,int>
#define priq priority_queue
#define mii map<int,int>
#define sz(x) (x).size()
#define stirng string
#define str to_string
#define rev reverse
#define pb push_back
#define ll long long
#define endl '\n'
#define S second
#define F first
const int Pi=3.1415926535;
const int inf=1e10+5;
const int MOD=1e9+7;
const int N=1e5+123;
const int lol=63;
using namespace std;
int tc=1;
void code( ){
int n,m;
cin>>n>>m;
int s[n+1];
FOR(i,1,n,1)cin>>s[i];
while(m--){
int l,r,k;
cin>>l>>r>>k;
bool ok=1;
vector <int> v;
FOR(i,l,r,1)v.pb(s[i]);
FOR(i,1,sz(v)-1,1){
if( v[i]<v[i-1] && v[i]+v[i-1]<=k)
swap(v[i],v[i-1]);
else if(v[i]<v[i-1]){
ok=0;
break;
}
}
if(ok)cout<<1;
else cout<<0;
cout<<'\n';
}
}signed main(){sonic //FREOPEN
//cin>>tc;
while(tc--){
code();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
sortbooks.cpp: In function 'void code()':
sortbooks.cpp:31:45: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | #define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
......
65 | FOR(i,1,sz(v)-1,1){
| ~~~~~~~~~~~
sortbooks.cpp:65:3: note: in expansion of macro 'FOR'
65 | FOR(i,1,sz(v)-1,1){
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |