Submission #473430

#TimeUsernameProblemLanguageResultExecution timeMemory
473430Ahmadsm2005Genetics (BOI18_genetics)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define endl '\n' #define modulo 998244353 #define modulo2 998244353 #define eps 0.00000001 //#define int long long #define PI acos(-1) #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") //#pragma GCC optimize("trapv") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops") #define sinDegrees(x) sin((x) * PI / 180.0) #define cosDegrees(x) cos((x) * PI / 180.0) #define tanDegrees(x) tan((x) * PI / 180.0) #define atanDegrees(x) atan(x)* 180.0 / PI #define asinDegrees(x) asin(x)* 180.0 / PI #define EPS 0.000000001 using namespace std; int power(int x,int y,int m=modulo) { if(y<0) return 0; int temp; if(y == 0) return 1; temp = (power(x, y/2,m))%m; if (y%2 == 0) return ((temp%m)*temp)%m; else return ((x*temp%m)*temp%m)%m; } int inv(int x,int m=modulo) { return (power(x,m-2,m))%m; } int n,m,k; bool BAD[4100]; string s; vector<int>lolz; vector<pair<string,int>>lolz2; bitset<4100>wow[4100]; bitset<4100>TEMP; int COMP(int x,int y){ int K=0; for(int i=0;i<m;i++) if(lolz2[x].first[i]!=lolz2[y].first[i]) K++; return K; } int32_t main() { cin.tie(0),iostream::sync_with_stdio(0); //freopen("halfnice.in","r",stdin); cin>>n>>m>>k; mt19937 rng(2005); bool NO=0; for(int i=0;i<n;i++){ cin>>s; lolz.push_back(i); lolz2.push_back({s[i],i}); for(int l=0;l<m;l++){ if(s[l]=='A') wow[i][l]=0; else if(s[l]=='C') wow[i][l]=1; else NO=1; } } if(!NO){ while(1){ shuffle(lolz.begin(),lolz.end(),rng); if(BAD[lolz[0]]) continue; for(int i=1;i<n;i++){ TEMP=wow[lolz[0]]^wow[lolz[i]]; if(TEMP.count()!=k){ BAD[lolz[0]]=1,BAD[lolz[i]]=1; goto a; } } cout<<lolz[0]+1<<endl; exit(0); a:; } } while(1){ shuffle(lolz2.begin(),lolz2.end(),rng); for(int i=1;i<n;i++){ if(COMP(0,i)!=k) goto a; } cout<<lolz2[0].second+1<<endl; break; a:; } }

Compilation message (stderr)

genetics.cpp: In function 'int32_t main()':
genetics.cpp:62:25: error: no matching function for call to 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::push_back(<brace-enclosed initializer list>)'
   62 | lolz2.push_back({s[i],i});
      |                         ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from genetics.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<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::__cxx11::basic_string<char>, 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<std::__cxx11::basic_string<char>, 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<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::__cxx11::basic_string<char>, 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<std::__cxx11::basic_string<char>, int> >::value_type&&' {aka 'std::pair<std::__cxx11::basic_string<char>, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
genetics.cpp:79:16: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   79 | if(TEMP.count()!=k){
      |    ~~~~~~~~~~~~^~~
genetics.cpp:97:1: error: duplicate label 'a'
   97 | a:;
      | ^