QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311619#7119. Longest TripYeahPotato#Compile Error//C++141.3kb2024-01-22 16:11:002024-04-28 09:23:20

Judging History

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

  • [2024-04-28 09:23:20]
  • 管理员手动重测本题所有提交记录
  • [2024-01-22 16:11:01]
  • 评测
  • [2024-01-22 16:11:00]
  • 提交

answer

#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector <int> vec;
#define q are_connected
#define pb push_back
vec a, b;
void app() {
	for (int i : b) a. pb(i);
	b. clear();
}
vec longest_trip(int n, int d) {
	a = vec {0}, b = vec {};
	for (int i=1; i<n; i++)
		if (q({a. back()}, {i})) {
			a. pb(i);
			if (! b. empty() && q({b. back()}, {i}))
				reverse (b. begin(), b. end()), app();
		} else b. pb(i);
	if (b. empty()) return a;
	if (! q(a, b)) return a. size() > b. size() ? a : b;
	if (q({a. back()}, b)) {
		int l = 0, r = b. size() - 2;
		while (l < r) {
			int mid = l + r >> 1;
			if (q({a. back()}, vec (b. begin(), b. begin() + mid + 1))) r = mid;
			else l = mid + 1;
		} return rotate (b. begin(), b. begin() + r, b. end()), app(), a;
	} else {
		int l = 0, r = a. size() - 2;
		while (l < r) {
			int mid = l + r >> 1;
			if (q(vec (a. begin(), a. begin() + mid + 1), b)) r = mid;
			else l = mid + 1;
		} r ? rotate (a. begin(), a. begin() + r + 1, a. end()) : reverse (a. begin(), a. end());
		l = 0, r = b. size() - 1;
		while (l < r) {
			int mid = l + r >> 1;
			if (q({a. back()}, vec (b. begin(), b. begin() + mid + 1))) r = mid;
			else l = mid + 1;
		} return rotate (b. begin(), b. begin() + r, b. end()), app(), a;
	}
}

Details

answer.code: In function ‘vec longest_trip(int, int)’:
answer.code:35:30: error: third operand to the conditional operator is of type ‘void’, but the second operand is neither a throw-expression nor of type ‘void’
   35 |                 } r ? rotate (a. begin(), a. begin() + r + 1, a. end()) : reverse (a. begin(), a. end());
      |                       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~