Submission #1839446


Source Code Expand

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(index,max) for(int index=0;index<max;index++)

using namespace std;

int main(){
    int n,m,x,y;
    vector<int> a;
    vector<int> b;
    int ans=0;
    int t=0;
    cin>>n>>m;
    cin>>x>>y;
    rep(i,n){int tmp;cin>>tmp;a.push_back(tmp);}
    rep(i,m){int tmp;cin>>tmp;b.push_back(tmp);}
    vector<int>::iterator itr=a.begin();
    
    while(1){
        t=*itr+n;
        if(binary_search(b.begin(),b.end(),t)) itr=lower_bound(b,b+m,t);
        else break;
        t=*itr+m;
        if(binary_search(a.begin(),a.end(),t)) itr=lower_bound(a,a+n,t);
        else break;
        ans++;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Submission Info

Submission Time
Task C - 飛行機乗り
User syoshida3104
Language C++14 (GCC 5.4.1)
Score 0
Code Size 766 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:67: error: no match for ‘operator+’ (operand types are ‘std::vector<int>’ and ‘int’)
         if(binary_search(b.begin(),b.end(),t)) itr=lower_bound(b,b+m,t);
                                                                   ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:2:
/usr/include/c++/5/bits/stl_iterator.h:341:5: note: candidate: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/5/bits/stl_iterator.h:341:5: note:   template argument deduction/substitution failed...