Submission #1091450

#TimeUsernameProblemLanguageResultExecution timeMemory
1091450AlmontherSeptember (APIO24_september)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff bool isvalid(vector<int>tre,vector<int>del){ int vis[tre.size()+5]={}; int canottake[tre.size()+5]={}; for(auto i:del) canottake[i]=1; vector<ll>v[tre.size()+5]; for(int i=0;i<tre.size();i++){ if(tre[i]==-1) continue; v[tre[i]].push_back(i); } queue<ll>proces; proces.push(0); while(proces.size()){ int num=proces.front(); proces.pop(); if(canottake[num]||vis[num]) continue; vis[num]=1; for(auto i:v[num]){ proces.push(i); } } for(int i=0;i<tre.size();i++){ if(vis[i]==0&&canottake[i]==0) return 0; } return 1; } int solve(int N,int M,vector<int>F,vector<vector<int>>S){ ll ans=0; map<ll,ll>mp[M+5]; vector<ll>curr[M+5]; for(int i=1;i<N;i++){ int isgood=1; for(int j=0;j<M;j++){ vector<int>curr; curr[j].push_back(S[j][k]); mp[j][S[j][k]]=1; if(!isvalid(F,curr[j])||mp[j]!=mp[0]) isgood=0; } ans+=isgood; } return ans; }

Compilation message (stderr)

september.cpp: In function 'bool isvalid(std::vector<int>, std::vector<int>)':
september.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<tre.size();i++){
      |                 ~^~~~~~~~~~~
september.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int i=0;i<tre.size();i++){
      |                 ~^~~~~~~~~~~
september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:43:21: error: request for member 'push_back' in 'curr.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   43 |             curr[j].push_back(S[j][k]);
      |                     ^~~~~~~~~
september.cpp:43:36: error: 'k' was not declared in this scope
   43 |             curr[j].push_back(S[j][k]);
      |                                    ^
september.cpp:45:34: error: could not convert 'curr.std::vector<int>::operator[](((std::vector<int>::size_type)j))' from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>'
   45 |             if(!isvalid(F,curr[j])||mp[j]!=mp[0]) isgood=0;
      |                                  ^
      |                                  |
      |                                  __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}