Submission #1032428

#TimeUsernameProblemLanguageResultExecution timeMemory
1032428AndreyGift Exchange (JOI24_ho_t4)C++14
0 / 100
2538 ms4056 KiB
#include<bits/stdc++.h> using namespace std; bool check(vector<pair<int,int>> haha) { sort(haha.begin(),haha.end()); vector<bool> wow(haha.size()+1); for(int i = 1; i < haha.size(); i++) { if(haha[i-1].first > haha[i].second) { wow[i] = 1; } } for(int i = 0; i < haha.size(); i++) { if(!wow[i] && !wow[i+1]) { return false; } } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,q,l,r; cin >> n; vector<int> a(n+1); vector<int> b(n+1); for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { cin >> b[i]; } cin >> q; for(int i = 0; i < q; i++) { cin >> l >> r; vector<pair<int,int>> haha(0); for(int j = l; j <= r; j++) { haha.push_back({a[j],b[j]}); } if(check(haha)) { cout << "Yes\n"; } else { cout << "No\n"; } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'bool check(std::vector<std::pair<int, int> >)':
Main.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 1; i < haha.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
Main.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < haha.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...