Submission #774197

#TimeUsernameProblemLanguageResultExecution timeMemory
774197gagik_2007Virus Experiment (JOI19_virus)C++17
0 / 100
41 ms8896 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=807; ll n,m,k; bool w[N][N]; bool e[N][N]; ll a[N][N]; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("output.txt","w",stdout); cin>>k>>n>>m; cin>>s; s+=s; int cw=(s[0]=='W'),ce=(s[0]=='E'); int wc=cw,ec=ce; for(int i=1;i<s.size();i++){ if(s[i]=='W'){ if(s[i]==s[i-1]){ cw++; } else{ ce=0; cw=1; } wc=max(wc,cw); } else{ if(s[i]==s[i-1]){ ce++; } else{ cw=0; ce=1; } ec=max(ec,ce); } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; } } int cntt=MOD; int cc=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(a[i][j]!=0){ int cj=j+1; int cnt=1; while(cj<n&&a[i][cj]<=wc&&a[i][cj]!=0){ cnt++; cj++; } cj=j-1; while(cj>=0&&a[i][cj]<=ec&&a[i][cj]!=0){ cnt++; cj--; } if(cnt<cntt){ cntt=cnt; cc=1; } else if(cnt==cntt){ cc++; } } } } cout<<cntt<<"\n"<<cc<<endl; }

Compilation message (stderr)

virus.cpp: In function 'int main()':
virus.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i=1;i<s.size();i++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...