Submission #379997

#TimeUsernameProblemLanguageResultExecution timeMemory
379997couplefireGenetics (BOI18_genetics)C++17
46 / 100
2090 ms41580 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") int n, m, k; pair<array<bitset<4105>, 4>, int> arr[4105]; char bruh[4105][4105]; //A:0, G:1, C:2, T:3 int main(){ // freopen("a.in", "r", stdin); scanf("%d %d %d", &n, &m, &k); srand(time(NULL)); for(int i = 0; i<n; ++i){ scanf("%s", bruh[i]); // printf("%s \n", bruh[i], bruh[i]+m); for(int j = 0; j<4; ++j) arr[i].first[j].reset(); arr[i].second = i; for(int j = 0; j<m; ++j){ if(bruh[i][j] == 'A') arr[i].first[0].set(j); else if(bruh[i][j] == 'G') arr[i].first[1].set(j); else if(bruh[i][j] == 'C') arr[i].first[2].set(j); else arr[i].first[3].set(j); } } random_shuffle(arr, arr+n); for(int i = 0; i<n; ++i){ bool work = true; for(int j = 0; j<n; ++j){ if(j == i) continue; int cnt = 0; for(int a = 0; a<4; ++a){ cnt += (arr[i].first[a]&arr[j].first[a]).count(); } // printf("%d \n", cnt); if(cnt != m-k){ work = false; break; } } if(work){ printf("%d \n", arr[i].second+1); return 0; } } }

Compilation message (stderr)

genetics.cpp:4: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("O3")
      | 
genetics.cpp:5: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("unroll-loops")
      | 
genetics.cpp: In function 'int main()':
genetics.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf("%s", bruh[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...