Submission #18113

# Submission time Handle Problem Language Result Execution time Memory
18113 2016-01-21T06:08:57 Z chan492811 구간 성분 (KOI15_interval) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <hash_map>
#include <unordered_map>
using namespace std;
int n,m,res;
char arr1[1510],arr2[1510];
vector<int> vt(26);
unordered_map <vector <int> ,bool> mp;
void vector_init(){
    int i;
    for(i=0;i<26;i++) vt[i]=0;
}
void init(int a){
    int i;
    for(i=0;i<a;i++) vt[arr1[i]-'a']++; mp[vt]=1;
    for(;i<n;i++){
        vt[arr1[i]-'a']++; vt[arr1[i-a]-'a']--; mp[vt]=1;
    }
}
void iscan(int a){
    int i;
    for(i=0;i<a;i++) vt[arr2[i]-'a']++; if(mp[vt]==1){ res=a; return; }
    for(;i<m;i++){
        vt[arr2[i]-'a']++; vt[arr2[i-a]-'a']--;
        if(mp[vt]==1){ res=a; return; }
    }
}
int main(){
    int i,j;
    scanf("%s %s",arr1,arr2); n=strlen(arr1); m=strlen(arr2);
    for(i=1;i<=min(n,m);i++){
        init(i); vector_init();
        iscan(i); vector_init();
        mp.clear();
    }
    printf("%d",res);
    return 0;
}

Compilation message

In file included from /usr/include/c++/4.9/backward/hash_map:60:0,
                 from interval.cpp:5:
/usr/include/c++/4.9/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^
In file included from /usr/include/c++/4.9/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.9/unordered_map:47,
                 from interval.cpp:6:
/usr/include/c++/4.9/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::__is_noexcept_hash<std::vector<int>, std::hash<std::vector<int> > >’:
/usr/include/c++/4.9/type_traits:134:12:   required from ‘struct std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > >’
/usr/include/c++/4.9/type_traits:145:38:   required from ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
/usr/include/c++/4.9/bits/unordered_map.h:100:66:   required from ‘class std::unordered_map<std::vector<int>, bool>’
interval.cpp:11:36:   required from here
/usr/include/c++/4.9/bits/hashtable_policy.h:85:33: error: no match for call to ‘(const std::hash<std::vector<int> >) (const std::vector<int>&)’
  noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
                                 ^
In file included from /usr/include/c++/4.9/bits/move.h:57:0,
                 from /usr/include/c++/4.9/bits/stl_pair.h:59,
                 from /usr/include/c++/4.9/utility:70,
                 from /usr/include/c++/4.9/algorithm:60,
                 from interval.cpp:3:
/usr/include/c++/4.9/type_traits: In instantiation of ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’:
/usr/include/c++/4.9/bits/unordered_map.h:100:66:   required from ‘class std::unordered_map<std::vector<int>, bool>’
interval.cpp:11:36:   required from here
/usr/include/c++/4.9/type_traits:145:38: error: ‘value’ is not a member of ‘std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > >’
     : public integral_constant<bool, !_Pp::value>
                                      ^
In file included from /usr/include/c++/4.9/unordered_map:48:0,
                 from interval.cpp:6:
/usr/include/c++/4.9/bits/unordered_map.h: In instantiation of ‘class std::unordered_map<std::vector<int>, bool>’:
interval.cpp:11:36:   required from here
/usr/include/c++/4.9/bits/unordered_map.h:100:66: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc>  _Hashtable;
                                                                  ^
/usr/include/c++/4.9/bits/unordered_map.h:107:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::key_type key_type;
                                             ^
/usr/include/c++/4.9/bits/unordered_map.h:108:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::value_type value_type;
                                               ^
/usr/include/c++/4.9/bits/unordered_map.h:109:48: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::mapped_type mapped_type;
                                                ^
/usr/include/c++/4.9/bits/unordered_map.h:110:43: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::hasher hasher;
                                           ^
/usr/include/c++/4.9/bits/unordered_map.h:111:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::key_equal key_equal;
                                              ^
/usr/include/c++/4.9/bits/unordered_map.h:112:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::allocator_type allocator_type;
                                                   ^
/usr/include/c++/4.9/bits/unordered_map.h:117:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::pointer  pointer;
                                             ^
/usr/include/c++/4.9/bits/unordered_map.h:118:50: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::const_pointer const_pointer;
                                                  ^
/usr/include/c++/4.9/bits/unordered_map.h:119:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::reference  reference;
                                               ^
/usr/include/c++/4.9/bits/unordered_map.h:120:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::const_reference const_reference;
                                                    ^
/usr/include/c++/4.9/bits/unordered_map.h:121:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::iterator  iterator;
                                              ^
/usr/include/c++/4.9/bits/unordered_map.h:122:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::const_iterator const_iterator;
                                                   ^
/usr/include/c++/4.9/bits/unordered_map.h:123:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::local_iterator local_iterator;
                                                   ^
/usr/include/c++/4.9/bits/unordered_map.h:124:57: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::const_local_iterator const_local_iterator;
                                                         ^
/usr/include/c++/4.9/bits/unordered_map.h:125:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::size_type  size_type;
                                               ^
/usr/include/c++/4.9/bits/unordered_map.h:126:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       typedef typename _Hashtable::difference_type difference_type;
                                                    ^
/usr/include/c++/4.9/bits/unordered_map.h:242:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       operator=(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.9/bits/unordered_map.h:340:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
  emplace(_Args&&... __args)
  ^
/usr/include/c++/4.9/bits/unordered_map.h:392:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       insert(const value_type& __x)
       ^
/usr/include/c++/4.9/bits/unordered_map.h:399:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
  insert(_Pair&& __x)
  ^
/usr/include/c++/4.9/bits/unordered_map.h:459:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       insert(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.9/bits/unordered_map.h:604:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       equal_range(const key_type& __x)
       ^
/usr/include/c++/4.9/bits/unordered_map.h:608:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<std::vector<int, std::allocator<int> > > >, std::__detail::__is_noexcept_hash<std::vector<int, std::allocator<int> >, std::hash<std::vector<int, std::allocator<int> > > > > >’
       equal_range(const key_type& __x) const
       ^
interval.cpp:11:36: error: no matching function for call to ‘std::unordered_map<std::vector<int>, bool>::unordered_map()’
 unordered_map <vector <int> ,bool> mp;
                                    ^
interval.cpp:11:36: note: candidates are:
In file included from /usr/include/c++/4.9/unordered_map:48:0,
                 from interval.cpp:6:
/usr/include/c++/4.9/bits/unordered_map.h:172:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&&) [with _Key = std::vector<int>; _Tp = bool; _Hash = std::hash<std::vector<int> >; _Pred = std::equal_to<std::vector<int> >; _Alloc = std::allocator<std::pair<const std::vector<int>, bool> >]
       unordered_map(unordered_map&&) = default;
       ^
/usr/include/c++/4.9/bits/unordered_map.h:172:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/4.9/bits/unordered_map.h:169:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&) [with _Key = std::vector<int>; _Tp = bool; _Hash = std::hash<std::vector<int> >; _Pred = std::equal_to<std::vector<int> >; _Alloc = std::allocator<std::pair<const std::vector<int>, bool> >]
       unordered_map(const unordered_map&) = default;
       ^
/usr/include/c++/4.9/bits/unordered_map.h:169:7: note:   candidate expects 1 argument, 0 provided
interval.cpp: In function ‘void init(int)’:
interval.cpp:18:43: error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::vector<int>, bool>’ and ‘std::vector<int>’)
     for(i=0;i<a;i++) vt[arr1[i]-'a']++; mp[vt]=1;
                                           ^
interval.cpp:20:51: error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::vector<int>, bool>’ and ‘std::vector<int>’)
         vt[arr1[i]-'a']++; vt[arr1[i-a]-'a']--; mp[vt]=1;
                                                   ^
interval.cpp: In function ‘void iscan(int)’:
interval.cpp:25:46: error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::vector<int>, bool>’ and ‘std::vector<int>’)
     for(i=0;i<a;i++) vt[arr2[i]-'a']++; if(mp[vt]==1){ res=a; return; }
                                              ^
interval.cpp:28:14: error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::vector<int>, bool>’ and ‘std::vector<int>’)
         if(mp[vt]==1){ res=a; return; }
              ^
interval.cpp: In function ‘int main()’:
interval.cpp:32:11: warning: unused variable ‘j’ [-Wunused-variable]
     int i,j;
           ^
In file included from /usr/include/c++/4.9/unordered_map:48:0,
                 from interval.cpp:6:
/usr/include/c++/4.9/bits/unordered_map.h: In instantiation of ‘void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::clear() [with _Key = std::vector<int>; _Tp = bool; _Hash = std::hash<std::vector<int> >; _Pred = std::equal_to<std::vector<int> >; _Alloc = std::allocator<std::pair<const std::vector<int>, bool> >]’:
interval.cpp:37:18:   required from here
/usr/include/c++/4.9/bits/unordered_map.h:528:9: error: using invalid field ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_M_h’
       { _M_h.clear(); }
         ^
interval.cpp:33:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s %s",arr1,arr2); n=strlen(arr1); m=strlen(arr2);
                             ^