이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#pragma GCC optimize("Ofast,unroll-loops,O3")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native")
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define x first
#define y second
#define N 500015
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, q;
pii arr[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> arr[i].x;
for (int i = 1; i <= n; i++)
cin >> arr[i].y;
cin >> q;
for (int t = 0; t < q; t++){
int l, r; cin >> l >> r;
vector<pii> vt;
for (int i = l; i <= r; i++)
vt.push_back(arr[i]);
sort(vt.begin(), vt.end());
int j = 1, ans = 1;
for (int i = 0; i < (int)vt.size() - 1; i++){
if (i == j)
j++;
while (j < vt.size() && vt[j].y > vt[i].x)
j++;
if (j >= vt.size())
ans = 0;
}
cout << (ans ? "Yes\n" : "No\n");
}
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:32:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | while (j < vt.size() && vt[j].y > vt[i].x)
| ~~^~~~~~~~~~~
Main.cpp:34:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | if (j >= vt.size())
| ~~^~~~~~~~~~~~
# | 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... |