Submission #445194

# Submission time Handle Problem Language Result Execution time Memory
445194 2021-07-16T20:02:51 Z AnYandEvery Tracks in the Snow (BOI13_tracks) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
  freopen("tracks.in", "r", stdin);
  freopen("tracks.out", "w", stdout);
  int H, W; cin >> H >> W;
  bool rabbit = false, fox = false;
  for(int r = 0; r < H; r++){
    for(int c = 0; c < W; c++){
      char c; cin >> c;
      if(c=='R')rabbit = true;
      if(c=='F')fox = true;
    }
  }
  int ret = 0;
  if(rabbit)ret++;
  if(fox)ret++;
  cout << ret << endl;
}

Compilation message

tracks.cpp: In function 'int main()':
tracks.cpp:10:12: error: redeclaration of 'char c'
   10 |       char c; cin >> c;
      |            ^
tracks.cpp:9:13: note: 'int c' previously declared here
    9 |     for(int c = 0; c < W; c++){
      |             ^
tracks.cpp:4:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    4 |   freopen("tracks.in", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tracks.cpp:5:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |   freopen("tracks.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~