Submission #570427

# Submission time Handle Problem Language Result Execution time Memory
570427 2022-05-29T19:30:27 Z NekoRolly Datum (COCI20_datum) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3+4;

struct fecha{
	int d,m,a;
};

bool operator<(fecha a,fecha b){
	return (a.a != b.a ? a.a < b.a : a.m != b.m ? a.m < b.m : a.d < b.d);
}

int q;
string s;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
vector<fecha> v;

void read(int &x){ x = 0;
	for (char c=getchar(); '0'<=c && c<='9'; c = getchar())
		x = x*10 + (c - '0');
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	for (int d1=0; d1<=9; d1++) for (int d2=0; d2<=9; d2++)
		for (int d3=0; d3<=9; d3++) for (int d4=0; d4<=9; d4++){
			int d = d4*10 + d3, m = d2*10 + d1, a = d1*1000 + d2*100 + d3*10 + d4;
			if (0 < m && m < 13 && 0 < d && d <= days[m] + (a%4 == 0 && m == 2))
				v.push_back({d, m, a});
		}

	read(q);

	for (fecha x; q; q--){ read(x.d), read(x.m), read(x.a); getchar();
		int i = 0;
		while (v[i] <= x) i++;
		if (v[i].d < 10) cout << "0"; cout << v[i].d << ".";
		if (v[i].m < 10) cout << "0"; cout << v[i].m << ".";
		if (v[i].a < 10) cout << "000";
		if (v[i].a < 100) cout << "00";
		if (v[i].a < 1000) cout << "0"; cout << v[i].a << ".\n";
	}

    return 0;
}

Compilation message

datum.cpp: In function 'int main()':
datum.cpp:38:15: error: no match for 'operator<=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} and 'fecha')
   38 |   while (v[i] <= x) i++;
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1086:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1086 |     operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1086:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1192:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)'
 1192 |     operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1192:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1285:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1285 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1285:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1359:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)'
 1359 |     operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1359:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   'fecha' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1453:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1453 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1453:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1531:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)'
 1531 |     operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1531:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   'fecha' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from datum.cpp:1:
/usr/include/c++/10/bits/regex.h:1631:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1631 |     operator<=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1631:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from datum.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:508:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  508 |     operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:508:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::pair<_T1, _T2>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from datum.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:384:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  384 |     operator<=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:384:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::reverse_iterator<_Iterator>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from datum.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:422:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  422 |     operator<=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:422:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::reverse_iterator<_Iterator>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from datum.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1460:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1460 |     operator<=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1460:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::move_iterator<_IteratorL>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from datum.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1513:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1513 |     operator<=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1513:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::move_iterator<_IteratorL>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/string_view:582:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  582 |     operator<=(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:582:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   'fecha' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/string_view:588:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)'
  588 |     operator<=(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:588:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   'fecha' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/string_view:595:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  595 |     operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:595:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   'fecha' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6343:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6343 |     operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6343:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6356:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6356 |     operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6356:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from datum.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6368:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6368 |     operator<=(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6368:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   mismatched types 'const _CharT*' and 'fecha'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from datum.cpp:1:
/usr/include/c++/10/array:299:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator<=(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)'
  299 |     operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
      |     ^~~~~~~~
/usr/include/c++/10/array:299:5: note:   template argument deduction/substitution failed:
datum.cpp:38:18: note:   '__gnu_cxx::__alloc_traits<std::allocator<fecha>, fecha>::value_type' {aka 'fecha'} is not derived from 'const std::array<_Tp, _Nm>'
   38 |   while (v[i] <= x) i++;
      |                  ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,