제출 #733791

#제출 시각아이디문제언어결과실행 시간메모리
733791vjudge1Collecting Mushrooms (NOI18_collectmushrooms)C++17
60 / 100
2072 ms4312 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> template<typename... T> void see(T&... args) {((cin >> args), ...);} template<typename... T> void put(T&&... args) {((cout << args << ' '), ...);} template<typename... T> void putl(T&&... args) {((cout << args << ' '), ...); cout << '\n';} #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define F first #define S second #define ii pair<int, int> #define vt vector #define pb push_back #define all(a) (a).begin(), (a).end() #define sz size() #define endl '\n' #define rep(i,a,b) for(int i=a; i<=b; i++) #define rev(i,b,a) for(int i=b; i>=a; i--) #define reada(a,x,y) for(int i=x; i<=y; i++){cin >> a[i];} const ll INF = INT_MAX; const ll M = 1e9+7; const int Mxn = 1e6, Nxn = 2*1e5, Mxm = 1e5, Nxm = 1005, Dxn = 1e9+1; vt< ii > m, s; int ans[Mxn]; void solve() { int r, c, k, d; see(r, c, d, k); rep(i,1,r) { rep(j,1,c) { char x; see(x); if(x == 'M') m.pb({i, j}); if(x == 'S') s.pb({i, j}); } } for(int i = 0; i < s.size(); i++) { int x1 = s[i].F - d, x2 = s[i].F + d, y1 = s[i].S - d, y2 = s[i].S + d; for(int j = 0; j < m.size(); j++) { int x = m[j].F, y = m[j].S; if(x1 <= x && x2 >= x && y1 <= y && y2 >= y) { ans[j]++; } } } int s = 0; for(int j = 0; j < m.size(); j++) { if(ans[j] >= k) s++; } cout << s; return; } signed main() { IOS int t=1; //cin >> t; while(t--) { solve(); cout << endl; } return 0; }

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

mushrooms.cpp: In function 'void solve()':
mushrooms.cpp:53:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int i = 0; i < s.size(); i++) {
      |                    ~~^~~~~~~~~~
mushrooms.cpp:56:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for(int j = 0; j < m.size(); j++) {
      |                        ~~^~~~~~~~~~
mushrooms.cpp:65:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int j = 0; j < m.size(); 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...