Submission #1067141

# Submission time Handle Problem Language Result Execution time Memory
1067141 2024-08-20T11:59:21 Z 0npata Tiles (BOI24_tiles) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define vec vector

const int INF = 1e17;

int32_t main() {
	int n, m;
	cin >> n >> m;

	vec<pair<int, int>> ps(n);
	for(int i = 0; i<n; i++) {
		cin >> ps[i].first >> ps[i].second;
	}

	vec<pair<int, int>> ps_filt{ps[0]};

	for(int i = 1; i<N-1; i++) {
		if(ps_filt.back().first == ps[i].first) {
			ps_filt.pop_back();
			ps_filt.push_back(ps[i]);
		}
		else {
			if(ps[i].second != ps[i+1].second) {
				ps_filt.push_back(ps[i]);
			}
		}
	}

	if(ps_filt[0].second % 2) {
		cout << ps_filt[0].first << '\n';
		return;
	}

	int ans = 0;
	for(int i = 1; i<ps_filt.size(); i++) {
		if(ps_filt[i].second % 2) {
			cout << ps_filt[i].first << '\n';
			return;
		}
	}
	cout << ps_filt.back().first << '\n';

}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:20:19: error: 'N' was not declared in this scope
   20 |  for(int i = 1; i<N-1; i++) {
      |                   ^
Main.cpp:34:3: error: return-statement with no value, in function returning 'int32_t' {aka 'int'} [-fpermissive]
   34 |   return;
      |   ^~~~~~
Main.cpp:38:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i = 1; i<ps_filt.size(); i++) {
      |                 ~^~~~~~~~~~~~~~~
Main.cpp:41:4: error: return-statement with no value, in function returning 'int32_t' {aka 'int'} [-fpermissive]
   41 |    return;
      |    ^~~~~~
Main.cpp:37:6: warning: unused variable 'ans' [-Wunused-variable]
   37 |  int ans = 0;
      |      ^~~