# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786929 | 2023-07-18T14:54:54 Z | MCi | Tracks in the Snow (BOI13_tracks) | C++14 | 698 ms | 389120 KB |
#include<bits/stdc++.h> #define file "D:\\CWistor\\code" using namespace std; #define ll long long #define MAX 100100 #define fi first #define se second #define ull unsigned long long #define pii pair<int,int> #define pll pair<ll,ll> #define vi vector<int> #define vl vector<long long> #define mem(a, b) memset((a), (b), sizeof((a))) #define all(c) (c).begin(), (c).end() const int MOD = 1e9 + 7; const int N = 2e6 + 6; const ll M = (ll)1e18 + 7LL; const int INF = 1e9 + 7; ll oo = 1e17 + 5; int n, m, a[5005][5005]; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int cnt = 0; void run_with_file() { if (fopen(file".inp", "r")) { freopen(file".inp", "r", stdin); freopen(file".out", "w", stdout); } } void inp(){ cin >> n >> m; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= m; ++j){ char x; cin >> x; if(x == '.') a[i][j] = 1; else a[i][j] = 0; } } } void dfs(int i, int j){ a[i][j] = 0; for(int k = 0; k < 4; ++k){ int i1 = i + dx[k]; int j1 = j + dy[k]; if(i1 >= 1 && i1 <= n && j1 >= 1 && j1 <= m && a[i1][j1] == 1){ a[i1][j1] = 0; dfs(i1, j1); } } } int main() { cin.tie(0)->sync_with_stdio(0); run_with_file(); inp(); for(int i = 1; i <= n; ++i){ for(int j = 1; j <= m; ++j){ if(a[i][j] == 1){ cnt++; dfs(i, j); } } } cout << cnt; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 3412 KB | Output isn't correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Incorrect | 1 ms | 456 KB | Output isn't correct |
4 | Incorrect | 3 ms | 3012 KB | Output isn't correct |
5 | Incorrect | 3 ms | 2388 KB | Output isn't correct |
6 | Incorrect | 0 ms | 324 KB | Output isn't correct |
7 | Incorrect | 1 ms | 468 KB | Output isn't correct |
8 | Incorrect | 1 ms | 468 KB | Output isn't correct |
9 | Correct | 1 ms | 848 KB | Output is correct |
10 | Incorrect | 2 ms | 1748 KB | Output isn't correct |
11 | Incorrect | 1 ms | 1236 KB | Output isn't correct |
12 | Incorrect | 2 ms | 1876 KB | Output isn't correct |
13 | Incorrect | 3 ms | 2388 KB | Output isn't correct |
14 | Incorrect | 3 ms | 2388 KB | Output isn't correct |
15 | Incorrect | 5 ms | 3540 KB | Output isn't correct |
16 | Incorrect | 4 ms | 3412 KB | Output isn't correct |
17 | Incorrect | 6 ms | 3928 KB | Output isn't correct |
18 | Incorrect | 3 ms | 3008 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 16212 KB | Output isn't correct |
2 | Incorrect | 28 ms | 13800 KB | Output isn't correct |
3 | Incorrect | 320 ms | 105572 KB | Output isn't correct |
4 | Incorrect | 90 ms | 37060 KB | Output isn't correct |
5 | Incorrect | 139 ms | 57036 KB | Output isn't correct |
6 | Incorrect | 186 ms | 94260 KB | Output isn't correct |
7 | Incorrect | 7 ms | 16852 KB | Output isn't correct |
8 | Incorrect | 9 ms | 16216 KB | Output isn't correct |
9 | Incorrect | 2 ms | 980 KB | Output isn't correct |
10 | Incorrect | 2 ms | 1876 KB | Output isn't correct |
11 | Incorrect | 7 ms | 16988 KB | Output isn't correct |
12 | Incorrect | 1 ms | 980 KB | Output isn't correct |
13 | Incorrect | 28 ms | 13896 KB | Output isn't correct |
14 | Incorrect | 17 ms | 9152 KB | Output isn't correct |
15 | Incorrect | 29 ms | 27076 KB | Output isn't correct |
16 | Incorrect | 11 ms | 5744 KB | Output isn't correct |
17 | Incorrect | 71 ms | 30176 KB | Output isn't correct |
18 | Incorrect | 149 ms | 89320 KB | Output isn't correct |
19 | Incorrect | 90 ms | 37144 KB | Output isn't correct |
20 | Incorrect | 71 ms | 28736 KB | Output isn't correct |
21 | Incorrect | 186 ms | 65780 KB | Output isn't correct |
22 | Incorrect | 146 ms | 57112 KB | Output isn't correct |
23 | Incorrect | 132 ms | 50800 KB | Output isn't correct |
24 | Incorrect | 163 ms | 58332 KB | Output isn't correct |
25 | Incorrect | 698 ms | 389120 KB | Output isn't correct |
26 | Incorrect | 162 ms | 74172 KB | Output isn't correct |
27 | Incorrect | 183 ms | 94308 KB | Output isn't correct |
28 | Incorrect | 195 ms | 94260 KB | Output isn't correct |
29 | Incorrect | 177 ms | 94240 KB | Output isn't correct |
30 | Incorrect | 177 ms | 92328 KB | Output isn't correct |
31 | Incorrect | 117 ms | 63244 KB | Output isn't correct |
32 | Incorrect | 213 ms | 102732 KB | Output isn't correct |