제출 #1254925

#제출 시각아이디문제언어결과실행 시간메모리
1254925liangjeremyGenetics (BOI18_genetics)C++20
100 / 100
277 ms20236 KiB
#include<bits/stdc++.h> #define fi first #define se second #define int long long using namespace std; using db=double; using sll=__int128; using lb=long double; int id(char c){ if(c=='A')return 0; if(c=='C')return 1; if(c=='G')return 2; if(c=='T')return 3; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); int n,m,k; cin>>n>>m>>k; vector<string>a(n); vector<int>w(n); int tot=0; for(int i=0; i<n; i++){ cin>>a[i]; w[i]=rand(); tot+=w[i]; } vector<vector<int>>v(4,vector<int>(m)); for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ v[id(a[i][j])][j]+=w[i]; } } for(int i=0; i<n; i++){ int cur=0; for(int j=0; j<m; j++){ for(int k=0; k<4; k++){ if(k==id(a[i][j]))continue; cur+=v[k][j]; } } if(k*(tot-w[i])==cur){ cout<<i+1<<'\n'; return 0; } } } /* O what can ail thee, knight-at-arms, Alone and palely loitering? The sedge has withered from the lake, And no birds sing. O what can ail thee, knight-at-arms, So haggard and so woe-begone? The squirrel’s granary is full, And the harvest’s done. I see a lily on thy brow, With anguish moist and fever-dew, And on thy cheeks a fading rose Fast withereth too. */

컴파일 시 표준 에러 (stderr) 메시지

genetics.cpp: In function 'long long int id(char)':
genetics.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...