제출 #1097370

#제출 시각아이디문제언어결과실행 시간메모리
1097370vjudge1Genetics (BOI18_genetics)C++14
100 / 100
235 ms33636 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int n,m,k; const int mod=1e9+7,base=331; ll const_string[5000],Sum,pos[70][5000],Hash[5000]; string xau[5000]; void Solve() { for(int i=1;i<=n;i++) { ll tong=0; for(int j=1;j<=m;j++) { tong+=pos[xau[i][j]-'A'][j]-const_string[i]; } if(tong==(Sum-const_string[i])*(m-k)) { cout<<i; return; } } } void Input() { cin>>n>>m>>k; Sum=0; for(int i=1;i<=n;i++) { cin>>xau[i]; xau[i]=" "+xau[i]; Hash[0]=0; for(int j=1;j<=m;j++) { Hash[j]=(Hash[j-1]*base%mod+xau[i][j]-'A')%mod; } const_string[i]=Hash[m]; Sum+=const_string[i]; for(int j=1;j<=m;j++) { pos[xau[i][j]-'A'][j]+=const_string[i]; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); if(fopen("a.inp","r")) { freopen("a.inp","r",stdin); freopen("a.out","w",stdout); } Input(); Solve(); }

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

genetics.cpp: In function 'int main()':
genetics.cpp:52:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |  freopen("a.inp","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~
genetics.cpp:53:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |  freopen("a.out","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...