# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
321214 | 2020-11-11T14:11:44 Z | prasanth30 | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 2000 ms | 6472 KB |
#include <bits/stdc++.h> using namespace std; //actual solution is at bottom// ////<pbds>//// /* #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // change null_type for map // change less to less_equal for multiset #define ook order_of_key #define fbo find_by_order*/ ///</pbds>/// #define int long long int #define ll long long #define ld long double #define pb push_back #define mp make_pair #define sz(x) (int)x.size() #define google(i) cout<<"Case #"<<i<<" :"; ///<constants>/// const int MOD = 1e9+7; // 998244353; // = (119<<23)+1 const int MX = 2e5+5; const ll INF = 1e18; const ld PI = 4*atan((ld)1); const int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0}; ///</constants>/// ///<IO>/// namespace io { void setIn(string s) { freopen(s.c_str(),"r",stdin); } void setOut(string s) { freopen(s.c_str(),"w",stdout); } void setIO(string s = "") { ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O // cin.exceptions(cin.failbit); // ex. throws exception when you try to read letter into int if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO } } using namespace io; ///</IO>/// ///<execution-time>/// #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) /*example for clock usage clock_t z = clock(); debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC); */ ///</execution-time>/// signed main(){ setIO(""); int r,c,d,k;cin>>r>>c>>d>>k; vector<pair<int,int>> mush,sprin; for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ char c;cin>>c; if(c=='.')continue; if(c=='M')mush.pb({i,j}); if(c=='S')sprin.pb({i,j}); } } int ans=0; for(int i=0;i<mush.size();i++){ int c=0; for(int j=0;j<sprin.size();j++){ if(max(abs(sprin[j].first-mush[i].first),abs(sprin[j].second-mush[i].second))<=d)c++; if(c>=k)break; } if(c>=k)ans++; } cout<<ans<<"\n"; return 0; } /* stuff you should look for * check whether you have read the problem correctly * int overflow, array bounds * special cases (n=1?), slow multiset operations * do smth instead of nothing and stay organized */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 21 ms | 620 KB | Output is correct |
9 | Correct | 3 ms | 396 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
3 | Correct | 9 ms | 748 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 492 KB | Output is correct |
3 | Correct | 4 ms | 620 KB | Output is correct |
4 | Correct | 4 ms | 620 KB | Output is correct |
5 | Correct | 4 ms | 620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2079 ms | 6472 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 21 ms | 620 KB | Output is correct |
9 | Correct | 3 ms | 396 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 4 ms | 492 KB | Output is correct |
13 | Correct | 9 ms | 748 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 5 ms | 492 KB | Output is correct |
17 | Correct | 4 ms | 492 KB | Output is correct |
18 | Correct | 4 ms | 620 KB | Output is correct |
19 | Correct | 4 ms | 620 KB | Output is correct |
20 | Correct | 4 ms | 620 KB | Output is correct |
21 | Execution timed out | 2079 ms | 6472 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |