Submission #433937

#TimeUsernameProblemLanguageResultExecution timeMemory
433937ismoilovVirus Experiment (JOI19_virus)C++14
0 / 100
2 ms512 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) void S() { int m, r, c; string d; cin >> m >> r >> c >> d; vector <int> ans; int maxe = 0, maxw = 0; if(d.find('W') == -1) maxe = m, maxw = 0; else{ int s = 0; fp(i,0,m){ int j = i, s = 0; while(d[(j%m)] == 'E') j ++, s ++; maxe = max(maxe, s); } } if(d.find('E') == -1) maxe = 0, maxw = m; else{ int s = 0; fp(i,0,m){ int j = i, s = 0; while(d[(j%m)] == 'W') j ++, s ++; maxw = max(maxw, s); } } int a[r][c]; fp(i,0,r) fp(j,0,c) cin >> a[i][j]; fp(i,0,r){ fp(j,0,c){ if(a[i][j] == 0) continue; int l = j-1, r = j + 1; int mx = 0; while(l >= 0 && a[i][l] <= maxw) mx ++, l --; while(r < c && a[i][r] <= maxe) mx ++, r ++; ans.push_back(mx); } } sort(all(ans)); int mx = 0; while(ans[mx] == ans[0]) mx ++; cout << mx << " "; /* for(auto it : ans) cout << it << " ";*/ cout << ans[0]+1; } int main() { IOS; S(); }

Compilation message (stderr)

virus.cpp: In function 'void S()':
virus.cpp:17:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  if(d.find('W') == -1)
      |     ~~~~~~~~~~~~^~~~~
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:21:3: note: in expansion of macro 'fp'
   21 |   fp(i,0,m){
      |   ^~
virus.cpp:20:7: warning: unused variable 's' [-Wunused-variable]
   20 |   int s = 0;
      |       ^
virus.cpp:28:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |  if(d.find('E') == -1)
      |     ~~~~~~~~~~~~^~~~~
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:32:3: note: in expansion of macro 'fp'
   32 |   fp(i,0,m){
      |   ^~
virus.cpp:31:7: warning: unused variable 's' [-Wunused-variable]
   31 |   int s = 0;
      |       ^
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:40:2: note: in expansion of macro 'fp'
   40 |  fp(i,0,r)
      |  ^~
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:41:3: note: in expansion of macro 'fp'
   41 |   fp(j,0,c)
      |   ^~
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:43:2: note: in expansion of macro 'fp'
   43 |  fp(i,0,r){
      |  ^~
virus.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
virus.cpp:44:3: note: in expansion of macro 'fp'
   44 |   fp(j,0,c){
      |   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...