214412026-01-13 08:58:36algoproÁruszállítás üres szakaszaicpp17Compilation error
// UUID: 124038d9-ac88-400a-bf79-67a76e698c47
#include <bits/stdc++.h>
using namespace std;

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

	vector<int> diffs(n+1, 0);
	for (int i=0;i<m;i++){
		int start, end;
		cin >> start >> end;
		diffs[start]++;
		diffs[end]--;
	}
	// for(int d:diffs){
	// 	cout << d << " ";
	// }
	// cout << "\n";

	int empty_section_count = 0;
	int total = 0;
	for(int i=0;i<=n;i++){
		total += diffs[i];
		if(total==0){ // found the beginning of an empty section
			empty_section_count++;
			while(i<n && total == 0){
				i++;
				total += diffs[i];
			}
		}
	}
	cout << diffs[1] == 0 ? empty_section_count : empty_section_count -1 ;
}
Compilation error
open /var/local/lib/isolate/409/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:33:26: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
   33 |         cout << diffs[1] == 0 ? empty_section_count : empty_section_count -1 ;
      |                          ^~ ~
      |                             |
      |                             int
main.cpp:33:26: note: candidate: 'operator==(int, int)' (built-in)
   33 |         cout << diffs[1] == 0 ? empty_section_count : empty_section_count -1 ;
      |         ~~~~~~~~~~~~~~~~~^~~~
main.cpp:33:26: note:   no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/12/regex:66,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:110,
                 from main.cpp:2:
/usr/include/c++/12/bits/regex.h:1063:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1063 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1063:5: note:   template argument deduction/substitution failed:
main.cpp:33:29: note:   'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   33 |         cout << diffs[1] == 0 ? empty_section_count : empty_section_count -1 ;
      |                             ^
/usr/include/c++/12/bits/regex.h:1159:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1159 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/regex.h:1159:5: note:   template argument deduction/substitution failed:
main.cpp:33:29: note:   'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits...