Submission #576639

#TimeUsernameProblemLanguageResultExecution timeMemory
576639AGEChecker (COCI19_checker)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define F first #define S second #define pb push_back using namespace std; const int N=1e6,M=3e3+2,mod=1e9+7; int out[N]; int x[N],y[N],z[N]; vector< pair< int,int> >adj[N]; main() { int x; cin>>x; int n; cin>>n; string s; cin>>s; map< pair<int,int> , pair<int,int> > mp; for(int i=1;i<=n;i++){ if(i==n) mp[{n,1}]={1,s[i-1]-'0'},mp[{1,n}]={1,s[i-1]-'0'}; mp[{i,i+1}]={1,s[i-1]-'0'}; mp[{i+1,i}]={1,s[i-1]-'0'}; } for(int i=0;i<n-3;i++){ cin>>x[i]>>y[i]>>z[i]; adj[x[i]].pb({y[i],z[i]}); adj[y[i]].pb({x[i],z[i]}); mp[{x[i],y[i]}]={1,z[i]}; mp[{y[i],x[i]}]={1,z[i]}; } int ok=0; for(int i=0;i<n-3;i++){ for(int j=0;j<n-3;j++){ if(i==j) continue; if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j]))) ok=1; } } int ok2=0; for(int i=0;i<n-3;i++){ for(int j=1;j<=n;j++){ if(j==x[i]||j==y[i]) continue; pair<int,int> p; p={0,0}; if((mp[{x[i],j}]. F!=0)&&(mp[{y[i],j}].F!=0)){ if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i])) ok2=1; } } } if(ok2==0&&ok==0) cout<<"tecno"<<endl; else if(ok==0&&ok2==1) cout<<"neispravno bojenje"<<endl; else cout<<"neispravna triangulacija"<<endl; return 0; }

Compilation message (stderr)

checker.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main()
      | ^~~~
checker.cpp: In function 'int main()':
checker.cpp:35:15: error: invalid types 'long long int[long long int]' for array subscript
   35 |         cin>>x[i]>>y[i]>>z[i];
      |               ^
checker.cpp:36:14: error: invalid types 'long long int[long long int]' for array subscript
   36 |         adj[x[i]].pb({y[i],z[i]});
      |              ^
checker.cpp:37:24: error: invalid types 'long long int[long long int]' for array subscript
   37 |         adj[y[i]].pb({x[i],z[i]});
      |                        ^
checker.cpp:37:33: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   37 |         adj[y[i]].pb({x[i],z[i]});
      |                                 ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
checker.cpp:38:14: error: invalid types 'long long int[long long int]' for array subscript
   38 |         mp[{x[i],y[i]}]={1,z[i]};
      |              ^
checker.cpp:38:11: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   38 |         mp[{x[i],y[i]}]={1,z[i]};
      |           ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<long long int, long long int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >::key_type&&' {aka 'std::pair<long long int, long long int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
checker.cpp:39:19: error: invalid types 'long long int[long long int]' for array subscript
   39 |         mp[{y[i],x[i]}]={1,z[i]};
      |                   ^
checker.cpp:39:11: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   39 |         mp[{y[i],x[i]}]={1,z[i]};
      |           ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<long long int, long long int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >::key_type&&' {aka 'std::pair<long long int, long long int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
checker.cpp:51:22: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                      ^
checker.cpp:51:37: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                                     ^
checker.cpp:51:55: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                                                       ^
checker.cpp:51:70: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                                                                      ^
checker.cpp:51:88: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                                                                                        ^
checker.cpp:51:103: error: invalid types 'long long int[long long int]' for array subscript
   51 |             if((min(x[i],y[i])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(x[j],y[j])))
      |                                                                                                       ^
checker.cpp:62:20: error: invalid types 'long long int[long long int]' for array subscript
   62 |             if(j==x[i]||j==y[i])
      |                    ^
checker.cpp:67:22: error: invalid types 'long long int[long long int]' for array subscript
   67 |             if((mp[{x[i],j}]. F!=0)&&(mp[{y[i],j}].F!=0)){
      |                      ^
checker.cpp:67:19: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   67 |             if((mp[{x[i],j}]. F!=0)&&(mp[{y[i],j}].F!=0)){
      |                   ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<long long int, long long int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >::key_type&&' {aka 'std::pair<long long int, long long int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
checker.cpp:69:26: error: invalid types 'long long int[long long int]' for array subscript
   69 |                 if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
      |                          ^
checker.cpp:69:23: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   69 |                 if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
      |                       ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<long long int, long long int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >::key_type&&' {aka 'std::pair<long long int, long long int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
checker.cpp:69:60: error: invalid types 'long long int[long long int]' for array subscript
   69 |                 if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
      |                                                            ^
checker.cpp:69:57: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   69 |                 if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
      |                                                         ^
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from checker.cpp:1:
/usr/include/c++/10/bits/stl_map.h:492:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  492 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:492:34: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type&' {aka 'const std::pair<long long int, long long int>&'}
  492 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_map.h:512:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = std::pair<long long int, long long int>; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, std::pair<long long int, long long int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::pair<long long int, long long int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long long int, long long int>]'
  512 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:512:29: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >::key_type&&' {aka 'std::pair<long long int, long long int>&&'}
  512 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
checker.cpp:69:76: error: invalid types 'long long int[long long int]' for array subscript
   69 |                 if((mp[{x[i],j}].S==mp[{y[i],j}].S)||(mp[{x[i],j}].S==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
      |                                                                            ^
checker.cpp:69:73: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, std::pair<long long int, long long int> >' and '<brace-enclosed initializer list>')
   69 |                 if((mp