답안 #937167

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937167 2024-03-03T14:59:21 Z melody_rules Tracks in the Snow (BOI13_tracks) C++17
0 / 100
2000 ms 53920 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));
  vector<vector<bool>> vis(n, vector<bool>(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;
    cout<<a<<" "<<b<<endl;
    q.pop();
    
    vis.at(a).at(b) = true;
    
    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) != '.' && !vis.at(a-1).at(b))
      q.push({a-1, b});
    
    if(a!=(m-1) && vec.at(a+1).at(b) != '.' && !vis.at(a+1).at(b))
      q.push({a+1, b});
    
    if(b!=0 && vec.at(a).at(b-1) != '.' && !vis.at(a).at(b-1))
      q.push({a, b-1});
    
    if(b!=(n-1) && vec.at(a).at(b+1) != '.' && !vis.at(a).at(b+1))
      q.push({a, b+1});
  }
  
  if(check1 && check2)
    cout<<2<<endl;
  
  else
    cout<<1<<endl;
    
    return 0;
}

Compilation message

tracks.cpp: In function 'int main()':
tracks.cpp:66:3: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   66 |   else
      |   ^~~~
tracks.cpp:69:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   69 |     return 0;
      |     ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 860 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 6 ms 792 KB Output isn't correct
5 Incorrect 3 ms 604 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 1 ms 348 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 640 KB Output isn't correct
13 Incorrect 3 ms 604 KB Output isn't correct
14 Incorrect 3 ms 604 KB Output isn't correct
15 Incorrect 9 ms 860 KB Output isn't correct
16 Incorrect 8 ms 860 KB Output isn't correct
17 Incorrect 9 ms 852 KB Output isn't correct
18 Incorrect 6 ms 856 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 860 KB Output isn't correct
2 Incorrect 51 ms 3272 KB Output isn't correct
3 Incorrect 540 ms 31972 KB Output isn't correct
4 Incorrect 122 ms 6740 KB Output isn't correct
5 Incorrect 301 ms 19380 KB Output isn't correct
6 Incorrect 529 ms 26708 KB Output isn't correct
7 Incorrect 3 ms 856 KB Output isn't correct
8 Incorrect 3 ms 856 KB Output isn't correct
9 Incorrect 3 ms 348 KB Output isn't correct
10 Incorrect 1 ms 348 KB Output isn't correct
11 Incorrect 3 ms 860 KB Output isn't correct
12 Incorrect 2 ms 348 KB Output isn't correct
13 Incorrect 51 ms 2140 KB Output isn't correct
14 Incorrect 30 ms 1372 KB Output isn't correct
15 Incorrect 34 ms 2392 KB Output isn't correct
16 Incorrect 24 ms 1116 KB Output isn't correct
17 Incorrect 137 ms 5072 KB Output isn't correct
18 Incorrect 133 ms 8724 KB Output isn't correct
19 Incorrect 121 ms 4708 KB Output isn't correct
20 Incorrect 114 ms 7504 KB Output isn't correct
21 Incorrect 301 ms 10944 KB Output isn't correct
22 Incorrect 309 ms 19380 KB Output isn't correct
23 Incorrect 251 ms 9048 KB Output isn't correct
24 Incorrect 299 ms 19408 KB Output isn't correct
25 Incorrect 559 ms 26192 KB Output isn't correct
26 Execution timed out 2064 ms 53920 KB Time limit exceeded
27 Incorrect 528 ms 18404 KB Output isn't correct
28 Incorrect 543 ms 18396 KB Output isn't correct
29 Incorrect 539 ms 18396 KB Output isn't correct
30 Incorrect 518 ms 18032 KB Output isn't correct
31 Incorrect 351 ms 11988 KB Output isn't correct
32 Incorrect 513 ms 18400 KB Output isn't correct