Submission #940322

# Submission time Handle Problem Language Result Execution time Memory
940322 2024-03-07T08:00:15 Z 1075508020060209tc Checker (COCI19_checker) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int ttt;
int n;
vector<pair<int,int>>e[200005];
vector<pair<int,int>>ne[200005];
vector<int>inter[400005];
bool cmp(int i,int j){
if(e[i].size()<e[j].size()){return 1;}
if(e[i].size()>e[j].size()){return 0;}
return i<j;
}
bool cmp2(pair<int,int>i,pair<int,int>j){
return cmp(i.first,j.first);
}
int clr[400005];
bool cyc3(){
for(int i=1;i<=n;i++){
    for(int j=0;j<e[i].size();j++){
        int v=e[i][j].first;
        if(cmp(i,v)){
            ne[i].push_back({v,e[i].second});
        }
    }
    sort(ne[i].begin(),ne[i].end());
}

int ret=0;
for(int a=1;a<=n;a++){
    for(pair<int,int>pr:ne[a]){
        int b=pr.first;
        clr[b]=pr.second;
        for(pair<int,int>pr2:ne[b]){
            int c=pr.first;
            if(mp[{a,c}]&&pr.second+clr[c]+mp[{a,c}]%3==0){
                ret++;
            }
        }
    }
}
return ret==n-2;
}


void solve(){
cin>>n;
string s;
cin>>s;
for(int i=0;i<s.size();i++){
    int v=s[i]-'0';
    int a=i+1;int b=i+2;
    if(i==n-1){
        b=1;
    }
    e[a].push_back({b,v});
    e[b].push_back({a,v});
}
vector<pair<int,int>>seg;
for(int i=1;i<=n-3;i++){
    int a;int b;int c;
    cin>>a>>b>>c;
    if(a>b){swap(a,b);}
    e[a].push_back({b,c});
    e[b].push_back({a,c});
    seg.push_back({a,b});
    seg.push_back({b,a+n});
}
sort(seg.begin(),seg.end());
int rt=seg[0].second;
for(int i=1;i<seg.size();i++){
    if(seg[i].first<rt){
        cout<<"neispravna triangulacija\n";
        return;
    }
    rt=max(rt,seg[i].second);
}
cout<<"tocno\n";


}


signed main(){
cin>>ttt;
while(ttt--)solve();


}

Compilation message

checker.cpp: In function 'bool cyc3()':
checker.cpp:22:18: 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]
   22 |     for(int j=0;j<e[i].size();j++){
      |                 ~^~~~~~~~~~~~
checker.cpp:25:37: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   25 |             ne[i].push_back({v,e[i].second});
      |                                     ^~~~~~
checker.cpp:25:44: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   25 |             ne[i].push_back({v,e[i].second});
      |                                            ^
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:16: error: 'mp' was not declared in this scope; did you mean 'cmp'?
   38 |             if(mp[{a,c}]&&pr.second+clr[c]+mp[{a,c}]%3==0){
      |                ^~
      |                cmp
checker.cpp: In function 'void solve()':
checker.cpp:52:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 | for(int i=0;i<s.size();i++){
      |             ~^~~~~~~~~
checker.cpp:73:14: 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]
   73 | for(int i=1;i<seg.size();i++){
      |             ~^~~~~~~~~~~