# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
786930 | 2023-07-18T14:57:32 Z | MCi | Tracks in the Snow (BOI13_tracks) | C++14 | 827 ms | 436396 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; ll n, m, a[5005][5005]; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; ll 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(); if(n == 1 && m == 1){ if(a[n][m] == 1) cout << 1; else cout << 0; exit(0); } 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 4436 KB | Output isn't correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Incorrect | 1 ms | 468 KB | Output isn't correct |
4 | Incorrect | 3 ms | 3584 KB | Output isn't correct |
5 | Incorrect | 3 ms | 2772 KB | Output isn't correct |
6 | Incorrect | 1 ms | 340 KB | Output isn't correct |
7 | Incorrect | 1 ms | 468 KB | Output isn't correct |
8 | Incorrect | 1 ms | 588 KB | Output isn't correct |
9 | Correct | 1 ms | 852 KB | Output is correct |
10 | Incorrect | 2 ms | 2004 KB | Output isn't correct |
11 | Incorrect | 1 ms | 1428 KB | Output isn't correct |
12 | Incorrect | 2 ms | 2260 KB | Output isn't correct |
13 | Incorrect | 3 ms | 2772 KB | Output isn't correct |
14 | Incorrect | 3 ms | 2772 KB | Output isn't correct |
15 | Incorrect | 5 ms | 4564 KB | Output isn't correct |
16 | Incorrect | 4 ms | 4436 KB | Output isn't correct |
17 | Incorrect | 6 ms | 4952 KB | Output isn't correct |
18 | Incorrect | 3 ms | 3588 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 16464 KB | Output isn't correct |
2 | Incorrect | 34 ms | 19940 KB | Output isn't correct |
3 | Incorrect | 349 ms | 155060 KB | Output isn't correct |
4 | Incorrect | 100 ms | 50460 KB | Output isn't correct |
5 | Incorrect | 158 ms | 85776 KB | Output isn't correct |
6 | Incorrect | 193 ms | 143876 KB | Output isn't correct |
7 | Incorrect | 8 ms | 17236 KB | Output isn't correct |
8 | Incorrect | 7 ms | 16468 KB | Output isn't correct |
9 | Incorrect | 2 ms | 1108 KB | Output isn't correct |
10 | Incorrect | 2 ms | 2004 KB | Output isn't correct |
11 | Incorrect | 8 ms | 17308 KB | Output isn't correct |
12 | Incorrect | 1 ms | 1108 KB | Output isn't correct |
13 | Incorrect | 31 ms | 19988 KB | Output isn't correct |
14 | Incorrect | 19 ms | 12724 KB | Output isn't correct |
15 | Incorrect | 36 ms | 31040 KB | Output isn't correct |
16 | Incorrect | 12 ms | 8276 KB | Output isn't correct |
17 | Incorrect | 81 ms | 44360 KB | Output isn't correct |
18 | Incorrect | 196 ms | 103380 KB | Output isn't correct |
19 | Incorrect | 102 ms | 50420 KB | Output isn't correct |
20 | Incorrect | 80 ms | 41156 KB | Output isn't correct |
21 | Incorrect | 209 ms | 95596 KB | Output isn't correct |
22 | Incorrect | 149 ms | 85848 KB | Output isn't correct |
23 | Incorrect | 152 ms | 75876 KB | Output isn't correct |
24 | Incorrect | 175 ms | 87368 KB | Output isn't correct |
25 | Incorrect | 827 ms | 436396 KB | Output isn't correct |
26 | Incorrect | 176 ms | 110504 KB | Output isn't correct |
27 | Incorrect | 212 ms | 141764 KB | Output isn't correct |
28 | Incorrect | 202 ms | 141772 KB | Output isn't correct |
29 | Incorrect | 214 ms | 141800 KB | Output isn't correct |
30 | Incorrect | 202 ms | 138916 KB | Output isn't correct |
31 | Incorrect | 134 ms | 93644 KB | Output isn't correct |
32 | Incorrect | 269 ms | 150256 KB | Output isn't correct |