QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#114896#6639. Disk TreejeffqiCompile Error//C++141.7kb2023-06-23 22:17:162023-06-23 22:17:20

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-23 22:17:20]
  • 评测
  • [2023-06-23 22:17:16]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define eb emplace_back
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) ((int)v.size())
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define umap unordered_map
using namespace std;
namespace qiqi {
	struct Data {
		int l,r,k;
		Data(int l = 0,int r = -1,int k = -1):l(max(l,0)),r(r),k(k) {}
		bool friend operator < (Data a,Data b) {
			return a.k < b.k;
		}
	};
	void main() {
		int n; cin >> n;
		vector<Data> a(n);
		for (int i = 0; i < n; i++) {
			int x,y,r;
			cin >> x >> y >> r;
			a[i] = Data(x-r,x+r+1,y);
		}
		sort(all(a));
		map<int,Data> c;
		c[-1] = Data();
		vector<array<int,4>> ans;
		for (auto [l,r,k]:a) {
			auto bit = prev(c.upper_bound(l)),eit = c.lower_bound(r);
			Data col = prev(eit)->se;
			for (auto it = bit; it != eit; it++) {
				int y = it->se.k;
				if (y != -1 && (it == bit || prev(it)->se.r <= it->se.l)) {
					int x = max(l,it->fi);
					ans.pb({x,k,x,y});
				}
			}
			c.erase(next(bit),eit);
			c[l] = Data(l,r,k);
			c.emplace(r,col);
		}
		Data lst;
		c.erase(c.begin());
		for (auto it = c.begin(); it != c.end(); it++) {
			if (it->se.k != -1) {
				if (it != c.begin() && prev(it)->se.r <= it->se.l) {
					ans.pb({it->fi,it->se.k,lst.r-1,lst.k});
					assert(lst != Data());
				}
				lst = it->se;
			}
		}
		if (n==100) cout << sz(ans) << '\n';
		cout << "YES\n";
		for (auto [a,b,c,d]:ans) {
			cout << a << ' ' << b << ' ' << c << ' ' << d << '\n';
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	qiqi::main();
	return 0;
}

詳細信息

answer.code: In function ‘void qiqi::main()’:
answer.code:35:27: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
   35 |                 for (auto [l,r,k]:a) {
      |                           ^
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
answer.code:55:52: error: no match for ‘operator!=’ (operand types are ‘qiqi::Data’ and ‘qiqi::Data’)
   55 |                                         assert(lst != Data());
      |                                                ~~~ ^~ ~~~~~~
      |                                                |      |
      |                                                |      qiqi::Data
      |                                                qiqi::Data
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1066:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator!=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)’
 1066 |     operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1066:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
answer.code:55:60: note:   ‘qiqi::Data’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |                                         assert(lst != Data());
      |                                                            ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1146: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>&)’
 1146 |     operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1146:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
answer.code:55:60: note:   ‘qiqi::Data’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
   55 |                                         assert(lst != Data());
      |                                                            ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1239: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>&)’
 1239 |     operator!=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1239:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
answer.code:55:60: note:   ‘qiqi::Data’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |                                         assert(lst != Data());
      |                                                            ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1313: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>&)’
 1313 |     operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1313:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/11/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from answer.code:1:
answer.code:55:60: note:   ‘qiqi::Data’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   55 |                                         assert(lst != Data());
      |                                                            ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c+...