QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294271#4831. Eager Sortingucup_team_qiuly#0 0ms0kbC++141.2kb2023-12-30 11:08:292023-12-30 11:08:30

Judging History

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

  • [2023-12-30 11:08:30]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-12-30 11:08:29]
  • 提交

answer

//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(...) fprintf (stderr, __VA_ARGS__)

#define lep(i, l, r) for (int i = (l), i##_end = (r); i <= i##_end; ++ i)
#define rep(i, r, l) for (int i = (r), i##_end = (l); i >= i##_end; -- i)

char _c; bool _f; template <class T> inline void IN (T & x) {
	_f = 0, x = 0; while (_c = getchar (), ! isdigit (_c)) if (_c == '-') _f = 1;
	while (isdigit (_c)) x = x * 10 + _c - '0', _c = getchar (); if (_f == 1) x = -x;
}

template <class T> inline void chkmin (T & x, T y) { if (x > y) x = y; }
template <class T> inline void chkmax (T & x, T y) { if (x < y) x = y; }

signed main () {
	srand (28315732);
	int n; IN (n);
	auto op = [&] (int x, int y) {
		if (x < y) swap (x, y);
		int u; IN (u); if (! ~ u) exit (0); return u;
	};
	function <void (int, int)> doit = [&] (int l, int r) -> void {
		if (l >= r) return ;
		int cur = l + rand () % (r - l + 1), x = l, y = r;
		while (x <= y) {
			if (x < cur) op (x, cur) ? cur = x ++ : ++ x;
			else if (y > cur) op (y, cur) ? cur = y -- : -- y;
			else break ;
		}
		doit (l, cur - 1), doit (cur + 1, r);
	}; doit (1, n);
	cout << -1 << " " << -1 << endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Instance #0 Time Limit Exceeded

Interactor to First Run

5

First Run to Interactor


Interactor to Second Run


Second Run to Interactor


Manager to Checker

WA
Invalid Operation 1216629976 22002

result: