이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
vector<ll> vals(n), req(n);
FOR(i,0,n) cin >> vals[i];
FOR(i,0,n) cin >> req[i];
ll q;
cin >> q;
FOR(i,0,q){
ll a,b;
cin >> a >> b;
a--;b--;
vector<ll> idk, idk2;
bool flag = false;
FOR(j,a,b+1){
idk.push_back(vals[j]);
idk2.push_back(req[j]);
}
sort(idk.begin(), idk.end());
sort(idk2.begin(), idk2.end());
ll l = idk.size()-1;
FORNEG(j, idk.size()-1, -1){
if (j != idk.size()-1 && l == j){
flag = 1;
break;
}
while (l>=0 && idk[l] >= idk2[j]) l--;
}
if (flag) cout << "No" << "\n";
else cout << "Yes" << "\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:37:10: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | if (j != idk.size()-1 && l == j){
| ~~^~~~~~~~~~~~~~~
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |