Submission #1001683

# Submission time Handle Problem Language Result Execution time Memory
1001683 2024-06-19T06:57:57 Z vjudge1 Robots (APIO13_robots) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
using ll  =  long long;

#ifdef U_U
#include "algo/debug.h"
#else
#define deb(x...) 42
#endif
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define szof(x) (int)x.size()
#define int ll
#define love bool

template<class T> void MIN(T& a, const T b) { b < a ? a = b, 1 : 0; }
template<class T> void MAX(T& a, const T b) { a < b ? a = b, 1 : 0; }

const int mod = 1e9 + 7;
const int N = 2e5 + 5;
const int inf = 2147483647;
const int INF = 9223372036854775807;
// Follow the white rabbit.

int n, w, h;
char e[505][505];

void ka () {
	cin >> n >> h >> w;
	pair <int, int> first = {0, 0}, second;
	for (int i = 1; i <= w; i ++) {
		for (int j = 1; j <= h; j ++) {
			cin >> e[i][j];
			if (e[i][j] >= '1' && e[i][j] <= '9') {
				if (first == {0, 0}) first = {i, j};
				else second = {i, j};
			}
		}
	}
	if (first.first > second.first) swap(first, second);
	if (first.second != second.second || first.first != 1 || second.first != n) cout << -1;
	else {
		cout << 1;
	}
}

const bool overflow = 0;

main() {
  freopen("haircut.in"	, "r", stdin); freopen("haircut.out", "w", stdout);
  cout.setf(ios::fixed);cout.precision(12);
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int tc = 1; 
  if (overflow) cin >> tc;
  for (int cs = 1; cs <= tc; cs ++) {
		#ifdef U_U
		cout << ":D\n";
		#endif
		ka();
		//if (cs != tc) cout << '\n';
  }
}

Compilation message

robots.cpp: In function 'void ka()':
robots.cpp:37:18: error: expected primary-expression before '{' token
   37 |     if (first == {0, 0}) first = {i, j};
      |                  ^
robots.cpp:37:17: error: expected ')' before '{' token
   37 |     if (first == {0, 0}) first = {i, j};
      |        ~        ^~
      |                 )
robots.cpp: At global scope:
robots.cpp:51:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   51 | main() {
      | ^~~~
robots.cpp: In function 'int main()':
robots.cpp:52:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |   freopen("haircut.in" , "r", stdin); freopen("haircut.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
robots.cpp:52:46: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |   freopen("haircut.in" , "r", stdin); freopen("haircut.out", "w", stdout);
      |                                       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~