답안 #937164

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937164 2024-03-03T14:51:07 Z melody_rules Tracks in the Snow (BOI13_tracks) C++17
0 / 100
2000 ms 1048576 KB
#include <bits/stdc++.h>
#define int long long
 
using namespace std;
 
signed main() {
  int n=0;
  int m=0;
  int a=0;
  int b=0;
  char c;
  int i=0;
  int j=0;
  
  bool check1=false;
  bool check2=false;
  
  cin>>n>>m;
  vector<vector<char>> vec(n, vector<char>(m));
  
  for(i=0;i<n;i++) {
    for(j=0;j<m;j++) {
      cin>>c;
      vec.at(i).at(j) = c;
    }
  }
  
  queue<pair<int, int>> q;
  q.push({0, 0});
  
  while(!q.empty()) {
    a = q.front().first;
    b = q.front().second;
    q.pop();
    
    if(vec.at(a).at(b) == 'R')
      check1 = true;
    
    else
      check2 = true;
    
    if(check1 && check2) {
      break;
    }
    
    if(a!=0 && vec.at(a-1).at(b) != '.')
      q.push({a-1, b});
    
    if(a!=(m-1) && vec.at(a+1).at(b) != '.')
      q.push({a+1, b});
    
    if(b!=0 && vec.at(a).at(b-1) != '.')
      q.push({a, b-1});
    
    if(b!=(n-1) && vec.at(a).at(b+1) != '.')
      q.push({a, b+1});
  }
  
  if(check1 && check2)
    cout<<2<<endl;
  
  else
    cout<<1<<endl;
  
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 856 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 6 ms 604 KB Output isn't correct
5 Incorrect 3 ms 604 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 1 ms 344 KB Output isn't correct
8 Incorrect 1 ms 344 KB Output isn't correct
9 Incorrect 1 ms 348 KB Output isn't correct
10 Incorrect 3 ms 348 KB Output isn't correct
11 Incorrect 2 ms 348 KB Output isn't correct
12 Incorrect 3 ms 600 KB Output isn't correct
13 Incorrect 5 ms 604 KB Output isn't correct
14 Incorrect 3 ms 604 KB Output isn't correct
15 Incorrect 9 ms 1184 KB Output isn't correct
16 Incorrect 8 ms 860 KB Output isn't correct
17 Incorrect 8 ms 920 KB Output isn't correct
18 Incorrect 5 ms 604 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1778 ms 1048576 KB Execution killed with signal 9
2 Incorrect 51 ms 3504 KB Output isn't correct
3 Execution timed out 2108 ms 1048576 KB Time limit exceeded
4 Incorrect 123 ms 7760 KB Output isn't correct
5 Runtime error 1877 ms 1048576 KB Execution killed with signal 9
6 Incorrect 520 ms 31824 KB Output isn't correct
7 Incorrect 2 ms 604 KB Output isn't correct
8 Runtime error 1648 ms 1048576 KB Execution killed with signal 9
9 Runtime error 1619 ms 1048576 KB Execution killed with signal 9
10 Runtime error 1675 ms 1048576 KB Execution killed with signal 9
11 Runtime error 1706 ms 1048576 KB Execution killed with signal 9
12 Runtime error 1669 ms 1048576 KB Execution killed with signal 9
13 Incorrect 66 ms 3392 KB Output isn't correct
14 Incorrect 30 ms 2140 KB Output isn't correct
15 Runtime error 1688 ms 1048576 KB Execution killed with signal 9
16 Incorrect 21 ms 1628 KB Output isn't correct
17 Incorrect 132 ms 8528 KB Output isn't correct
18 Runtime error 1817 ms 1048576 KB Execution killed with signal 9
19 Incorrect 126 ms 7716 KB Output isn't correct
20 Runtime error 1704 ms 1048576 KB Execution killed with signal 9
21 Incorrect 302 ms 18516 KB Output isn't correct
22 Runtime error 1889 ms 1048576 KB Execution killed with signal 9
23 Incorrect 251 ms 15444 KB Output isn't correct
24 Runtime error 1883 ms 1048576 KB Execution killed with signal 9
25 Execution timed out 2089 ms 1048576 KB Time limit exceeded
26 Runtime error 1528 ms 1048576 KB Execution killed with signal 9
27 Incorrect 526 ms 31692 KB Output isn't correct
28 Incorrect 520 ms 31700 KB Output isn't correct
29 Incorrect 522 ms 31824 KB Output isn't correct
30 Incorrect 510 ms 31120 KB Output isn't correct
31 Incorrect 337 ms 20908 KB Output isn't correct
32 Incorrect 522 ms 31820 KB Output isn't correct