제출 #1005976

#제출 시각아이디문제언어결과실행 시간메모리
1005976kebineCollecting Mushrooms (NOI18_collectmushrooms)C++17
0 / 100
7 ms8412 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, m, d, s; cin >> n >> m >> d >> s; string grid[n + 1]; for ( int i = 0; i < n; i++) cin >> grid[i]; vector < int > a ( n + 5, 0), b ( n + 5, 0); vector < pair < int, int > > tanaman; for ( int i = 0; i < n; i++){ for ( int j = 0; j < m; j++){ if ( grid[i][j] == 'M' ){ tanaman.push_back({i, j}); } if ( grid[i][j] == 'S' ){ int xmn = max ( 0ll, i - d); int xmx = min ( n, i + d ); a[xmn]++; a[xmx + 1]--; int ymn = max ( 0ll, j - d); int ymx = min ( m, j + d); b[ymn]++; b[xmx + 1]--; } } } for ( int i = 1; i < n; i++) a[i] += a[i - 1]; for ( int i = 1; i < m; i++) b[i] += b[i - 1]; int cnt = 0; for ( int i = 0; i < tanaman.size(); i++){ int x = tanaman[i].first, y = tanaman[i].second; int mx = min ( a[x], b[y] ); if ( mx >= s ) cnt++; } cout << cnt << endl; }

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

mushrooms.cpp: In function 'int main()':
mushrooms.cpp:34:21: warning: unused variable 'ymx' [-Wunused-variable]
   34 |                 int ymx = min ( m, j + d);
      |                     ^~~
mushrooms.cpp:48:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for ( int i = 0; i < tanaman.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...