제출 #1006008

#제출 시각아이디문제언어결과실행 시간메모리
1006008kebineCollecting Mushrooms (NOI18_collectmushrooms)C++17
100 / 100
27 ms31380 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define fi first #define se second #define pb push_back #define bupol __builtin_popcount signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int r, c, d, s; cin >> r >> c >> d >> s; char grid[r+5][c+5]; int tmp[r+5][c+5]; memset(tmp, 0, sizeof tmp); int add[c+5]; memset(add,0,sizeof add); vector<pair<int,int>>v; for(int i = 1; i <= r; i++){ string s; cin >> s; for(int j = 0; j < s.length(); j++){ grid[i][j+1] = s[j]; if(s[j] == 'S'){ tmp[max(1ll,i-d)][max(1ll,j+1ll-d)]++; tmp[max(1ll,i-d)][min(c+1,j+2+d)]--; tmp[min(r+1,i+d+1ll)][max(1ll,j+1ll-d)]--; tmp[min(r+1,i+d+1ll)][min(c+1,j+2+d)]++; } } } int ans = 0; for(int i = 1; i <= r; i++){ int cnt = 0; for(int j = 1; j <= c; j++){ //cout << "here >> " << i << " " << j << " " << tmp[i][j] << endl; add[j] += tmp[i][j]; cnt += add[j]; if(grid[i][j] == 'M' && cnt >= s){ ans++; } } } cout << ans << endl; }

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

mushrooms.cpp: In function 'int main()':
mushrooms.cpp:21:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int j = 0; j < s.length(); j++){
      |                        ~~^~~~~~~~~~~~
#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...