Submission #64986576


Source Code Expand

// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")

#include <assert.h>

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define dump(x) cerr << #x << " = " << (x) << endl;

using namespace std;

const int64_t CYCLES_PER_SEC = 2900000000;
const double TIMELIMIT = 2.95;
struct Timer {
	int64_t start;
	Timer() { reset(); }
	void reset() { start = getCycle(); }
	void plus(double a) { start -= (a * CYCLES_PER_SEC); }
	inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
	inline int64_t getCycle() {
		uint32_t low, high;
		__asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
		return ((int64_t)low) | ((int64_t)high << 32);
	}
};
Timer timer;
class XorShift {
   public:
	unsigned int x, y, z, w;
	double nL[65536];

	XorShift() {
		init();
	}

	void init() {
		x = 314159265;
		y = 358979323;
		z = 846264338;
		w = 327950288;
		double n = 1 / (double)(2 * 65536);
		for (int i = 0; i < 65536; i++) {
			nL[i] = log(((double)i / 65536) + n);
		}
	}

	inline unsigned int next() {
		unsigned int t = x ^ x << 11;
		x = y;
		y = z;
		z = w;
		return w = w ^ w >> 19 ^ t ^ t >> 8;
	}

	inline double nextLog() {
		return nL[next() & 0xFFFF];
	}

	inline int nextInt(int m) {
		return (int)(next() % m);
	}

	int nextInt(int min, int max) {
		return min + nextInt(max - min + 1);
	}

	inline double nextDouble() {
		return (double)next() / ((long long)1 << 32);
	}
};
XorShift rnd;
struct FastSet {
	vector<int> list;
	vector<int> pos;
	void init(int N) {
		pos.resize(N, -1);
		list.reserve(N);
	}
	void insert_all() {
		list.clear();
		list.resize(pos.size());
		for (int i = 0; i < list.size(); i++) {
			pos[i] = list[i] = i;
		}
	}
	void insert(int a) {
		if (pos[a] == -1) {
			pos[a] = list.size();
			list.push_back(a);
		}
	}
	void erase(int a) {
		if (pos[a] >= 0) {
			swap(list[pos[a]], list.back());
			pos[list[pos[a]]] = pos[a];
			pos[a] = -1;
			list.pop_back();
		}
	}
	void flip(int a) {
		if (pos[a] == -1) {
			pos[a] = list.size();
			list.push_back(a);
		} else {
			swap(list[pos[a]], list.back());
			pos[list[pos[a]]] = pos[a];
			pos[a] = -1;
			list.pop_back();
		}
	}
	inline int size() {
		return list.size();
	}
	inline int rand() {
		return list[rnd.nextInt(list.size())];
	}
	inline void erase_all() {
		for (int i : list) {
			pos[i] = -1;
		}
		list.clear();
	}
};
struct FastSet2 {
	vector<int> list;
	vector<int> pos;
	int sz;
	void init(int N) {
		sz = 0;
		pos.resize(N);
		list.resize(N);
		for (int i = 0; i < N; i++) {
			pos[i] = list[i] = i;
		}
	}
	void insert_all() {
		sz = list.size();
	}
	int getAny() {
		return list[sz++];
	}
	void insert(int a) {
		if (pos[a] >= sz) {
			pos[list[sz]] = pos[a];
			swap(list[pos[a]], list[sz]);
			pos[a] = sz;
			sz++;
		}
	}
	void erase(int a) {
		if (pos[a] < sz) {
			sz--;
			pos[list[sz]] = pos[a];
			swap(list[pos[a]], list[sz]);
			pos[a] = sz;
		}
	}
	inline int size() {
		return sz;
	}
	inline int rand() {
		return list[rnd.nextInt(sz)];
	}
	inline void erase_all() {
		sz = 0;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	bool unionSet(int x, int y) {
		x = root(x);
		y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};
const int REV[4] = {2, 3, 0, 1};
const string DIR = "DRUL";
int X, Y, Z;

int Ax[100], Ay[100];
int Bx[100], By[100];
int Cx[100], Cy[100];
int emptyx, emptyy;
void init() {
	// determine emptyx, emptyy, which does not overlap with Ax, Ay, Bx, By, Cx, Cy

	emptyx = 0;
	emptyy = 0;
	while (true) {
		bool ok = true;
		for (int i = 0; i < X; i++) {
			if (Ax[i] == emptyx && Ay[i] == emptyy) {
				ok = false;
				break;
			}
		}
		for (int i = 0; i < Y; i++) {
			if (Bx[i] == emptyx && By[i] == emptyy) {
				ok = false;
				break;
			}
		}
		for (int i = 0; i < Z; i++) {
			if (Cx[i] == emptyx && Cy[i] == emptyy) {
				ok = false;
				break;
			}
		}
		if (ok) break;
		emptyx++;
		if (emptyx > 1000000) {
			cerr << "no empty cell" << endl;
			exit(1);
		}
	}
}

double get_dist(int x1, int y1, int x2, int y2) {
	return sqrt((long long)(x1 - x2) * (x1 - x2) + (long long)(y1 - y2) * (y1 - y2));
}

// def orient(a, b, p):
//     return (b[0] - a[0]) * (p[1] - a[1]) - (b[1] - a[1]) * (p[0] - a[0])

// def contains(p, a, b, c):
//     # degenerate (colinear) case
//     if orient(a, b, c) == 0:
//         if orient(a, b, p) != 0 or orient(a, c, p) != 0:
//             return False
//         xs = (a[0], b[0], c[0])
//         ys = (a[1], b[1], c[1])
//         return min(xs) <= p[0] <= max(xs) and min(ys) <= p[1] <= max(ys)

//     # non‐degenerate: check same side of all edges
//     c1 = orient(a, b, p)
//     c2 = orient(b, c, p)
//     c3 = orient(c, a, p)
//     return (c1 >= 0 and c2 >= 0 and c3 >= 0) or (c1 <= 0 and c2 <= 0 and c3 <= 0)

bool isintriangle(int x, int y, int ax, int ay, int bx, int by, int cx, int cy) {
	int minx = min(ax, min(bx, cx)), maxx = max(ax, max(bx, cx));
	int miny = min(ay, min(by, cy)), maxy = max(ay, max(by, cy));
	if (x < minx || x > maxx || y < miny || y > maxy) return false;
  
	  long long c1 = (long long)(bx - ax) * (y - ay) - (long long)(by - ay) * (x - ax);
	  long long c2 = (long long)(cx - bx) * (y - by) - (long long)(cy - by) * (x - bx);
	  long long c3 = (long long)(ax - cx) * (y - cy) - (long long)(ay - cy) * (x - cx);
	  // degenerate (colinear) case
	  if (c1 == 0 && c2 == 0 && c3 == 0) {
		  return min(ax, min(bx, cx)) <= x && x <= max(ax, max(bx, cx)) &&
				 min(ay, min(by, cy)) <= y && y <= max(ay, max(by, cy));
	  }
	  // non‐degenerate case
	  if ((c1 >= 0 && c2 >= 0 && c3 >= 0) || (c1 <= 0 && c2 <= 0 && c3 <= 0)) {
		  return true;
	  }
	  return false;
  }

bool isonline(int x, int y, int ax, int ay, int bx, int by) {
	return (long long)(bx - ax) * (y - ay) == (long long)(by - ay) * (x - ax);
}

bool isinfield(int x, int y) {
	return (0 <= x && x < 1000000 && 0 <= y && y < 1000000);
}

struct Solution {
	int Lx1, Ly1, Rx1, Ry1;
	int Lx2, Ly2, Rx2, Ry2;
	Solution() {}
	Solution(int Lx1, int Ly1, int Rx1, int Ry1, int Lx2, int Ly2, int Rx2, int Ry2)
		: Lx1(Lx1), Ly1(Ly1), Rx1(Rx1), Ry1(Ry1), Lx2(Lx2), Ly2(Ly2), Rx2(Rx2), Ry2(Ry2) {
	}
};

int best_step = 0;
double eval(vector<Solution>& sol) {
	FastSet2 fsA;
	FastSet2 fsB;
	FastSet2 fsC;
	fsA.init(X);
	fsA.insert_all();
	fsB.init(Y);
	fsB.insert_all();
	fsC.init(Z);
	fsC.insert_all();
	double score = 0;

	int tot = X + Y;
	best_step = sol.size();
	for (int i = 0; i < (int)sol.size() - 1; i++) {
		if (tot == 0) {
			best_step = i + 1;
			break;
		}
		if (Y == 0) {
			score += get_dist(sol[i].Lx1, sol[i].Ly1, sol[i + 1].Lx1, sol[i + 1].Ly1) +
					 get_dist(sol[i].Rx1, sol[i].Ry1, sol[i + 1].Rx1, sol[i + 1].Ry1);
		} else {
			double distA = get_dist(sol[i].Lx1, sol[i].Ly1, sol[i + 1].Lx1, sol[i + 1].Ly1) +
						   get_dist(sol[i].Rx1, sol[i].Ry1, sol[i + 1].Rx1, sol[i + 1].Ry1);
			double distB = get_dist(sol[i].Lx2, sol[i].Ly2, sol[i + 1].Lx2, sol[i + 1].Ly2) +
						   get_dist(sol[i].Rx2, sol[i].Ry2, sol[i + 1].Rx2, sol[i + 1].Ry2);
			score += max(distA, distB);
		}
		for (int _j = fsA.sz - 1; _j >= 0; _j--) {
			int j = fsA.list[_j];
			if (isintriangle(Ax[j], Ay[j], sol[i].Lx1, sol[i].Ly1, sol[i].Rx1, sol[i].Ry1,
							 sol[i + 1].Lx1, sol[i + 1].Ly1)) {
				tot--;
				fsA.erase(j);
			} else if (isintriangle(Ax[j], Ay[j], sol[i + 1].Lx1, sol[i + 1].Ly1, sol[i].Rx1, sol[i].Ry1,
									sol[i + 1].Rx1, sol[i + 1].Ry1)) {
				tot--;
				fsA.erase(j);
			} else if (Y > 0) {
				if (isintriangle(Ax[j], Ay[j], sol[i].Lx2, sol[i].Ly2, sol[i].Rx2, sol[i].Ry2,
								 sol[i + 1].Lx2, sol[i + 1].Ly2)) {
					return -i;
				} else if (isintriangle(Ax[j], Ay[j], sol[i + 1].Lx2, sol[i + 1].Ly2, sol[i].Rx2, sol[i].Ry2,
										sol[i + 1].Rx2, sol[i + 1].Ry2)) {
					return -i;
				}
			}
		}
		for (int _j = fsB.sz - 1; _j >= 0; _j--) {
			int j = fsB.list[_j];
			if (isintriangle(Bx[j], By[j], sol[i].Lx1, sol[i].Ly1, sol[i].Rx1, sol[i].Ry1,
							 sol[i + 1].Lx1, sol[i + 1].Ly1)) {
				return -i;
			} else if (isintriangle(Bx[j], By[j], sol[i + 1].Lx1, sol[i + 1].Ly1, sol[i].Rx1, sol[i].Ry1,
									sol[i + 1].Rx1, sol[i + 1].Ry1)) {
				return -i;
			} else if (Y > 0) {
				if (isintriangle(Bx[j], By[j], sol[i].Lx2, sol[i].Ly2, sol[i].Rx2, sol[i].Ry2,
								 sol[i + 1].Lx2, sol[i + 1].Ly2)) {
					tot--;
					fsB.erase(j);
				} else if (isintriangle(Bx[j], By[j], sol[i + 1].Lx2, sol[i + 1].Ly2, sol[i].Rx2, sol[i].Ry2,
										sol[i + 1].Rx2, sol[i + 1].Ry2)) {
					tot--;
					fsB.erase(j);
				}
			}
		}

		for (int _j = fsC.sz - 1; _j >= 0; _j--) {
			int j = fsC.list[_j];
			if (isintriangle(Cx[j], Cy[j], sol[i].Lx1, sol[i].Ly1, sol[i].Rx1, sol[i].Ry1,
							 sol[i + 1].Lx1, sol[i + 1].Ly1)) {
				return -i;
			} else if (isintriangle(Cx[j], Cy[j], sol[i + 1].Lx1, sol[i + 1].Ly1, sol[i].Rx1, sol[i].Ry1,
									sol[i + 1].Rx1, sol[i + 1].Ry1)) {
				return -i;
			} else if (Y > 0) {
				if (isintriangle(Cx[j], Cy[j], sol[i].Lx2, sol[i].Ly2, sol[i].Rx2, sol[i].Ry2,
								 sol[i + 1].Lx2, sol[i + 1].Ly2)) {
					return -i;
				} else if (isintriangle(Cx[j], Cy[j], sol[i + 1].Lx2, sol[i + 1].Ly2, sol[i].Rx2, sol[i].Ry2,
										sol[i + 1].Rx2, sol[i + 1].Ry2)) {
					return -i;
				}
			}
		}
	}
	if (tot != 0) {
		return -sol.size();
	}
	// cerr << "A, B, C = " << A << ", " << B << ", " << C << endl;
	// int tot = X + Y + Z;
	// int taken = A + B + C;
	// cerr << "tot, taken = " << tot << ", " << taken << endl;
	return score;
}

vector<int> solve_TSP(int X[], int Y[], int N, int obsX[], int obsY[], int M, double timelimit) {
	vector<int> order(N);
	if (N == 0) return order;
	for (int i = 0; i < N; i++) {
		order[i] = i;
	}

	vector<vector<double> > dist(N, vector<double>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			dist[i][j] = get_dist(X[i], Y[i], X[j], Y[j]);
			// check if the line between i and j intersects with any of the obstacles
			for (int k = 0; k < M; k++) {
				if (isonline(obsX[k], obsY[k], X[i], Y[i], X[j], Y[j])) {
					dist[i][j] += 1e7;
					break;
				}
			}
			dist[j][i] = dist[i][j];
		}
	}
	double initial_score = 0;
	for (int i = 0; i < N - 1; i++) {
		initial_score += dist[order[i]][order[i + 1]];
	}
	// initial score
	cerr << "initial score = " << initial_score << endl;
	double score = initial_score;
	// simulated annealing
	double T_init = 1e4;
	double st = timer.get();
	double coef = 1 / (timelimit - st);
	while (true) {
		double ti = timer.get();
		if (ti > timelimit) break;
		double progress = (ti - st) * coef;
		double T = T_init * (1 - progress);
		// consider first and last point are not connected
		int i = rnd.nextInt(N);
		int j = rnd.nextInt(N - 1);
		if (j >= i) j++;
		if (i > j) swap(i, j);
		double diff = 0;
		if (i > 0) diff -= dist[order[i]][order[i - 1]];
		if (j < N - 1) diff -= dist[order[j]][order[j + 1]];
		if (i > 0) diff += dist[order[i - 1]][order[j]];
		if (j < N - 1) diff += dist[order[i]][order[j + 1]];
		if (diff < 0 || diff < -T * rnd.nextLog()) {
			reverse(order.begin() + i, order.begin() + j + 1);
			score += diff;
		}
	}
	cerr << "final score = " << score << endl;
	return order;
}

vector<Solution> construct_sol_from_take(vector<char> takeL1, vector<char> takeR1, vector<char> takeL2,
										 vector<char> takeR2, vector<Solution>& sol) {
	vector<Solution> sol2;
	Solution s;
	for (int i = 0; i < sol.size(); i++) {
		if (takeL1[i] == 1) {
			s.Lx1 = sol[i].Lx1;
			s.Ly1 = sol[i].Ly1;
			break;
		}
	}
	for (int i = 0; i < sol.size(); i++) {
		if (takeR1[i] == 1) {
			s.Rx1 = sol[i].Rx1;
			s.Ry1 = sol[i].Ry1;
			break;
		}
	}
	for (int i = 0; i < sol.size(); i++) {
		if (takeL2[i] == 1) {
			s.Lx2 = sol[i].Lx2;
			s.Ly2 = sol[i].Ly2;
			break;
		}
	}
	for (int i = 0; i < sol.size(); i++) {
		if (takeR2[i] == 1) {
			s.Rx2 = sol[i].Rx2;
			s.Ry2 = sol[i].Ry2;
			break;
		}
	}

	for (int i = 0; i < sol.size(); i++) {
		if (takeL1[i] == 1) {
			s.Lx1 = sol[i].Lx1;
			s.Ly1 = sol[i].Ly1;
		}
		if (takeR1[i] == 1) {
			s.Rx1 = sol[i].Rx1;
			s.Ry1 = sol[i].Ry1;
		}
		if (takeL2[i] == 1) {
			s.Lx2 = sol[i].Lx2;
			s.Ly2 = sol[i].Ly2;
		}
		if (takeR2[i] == 1) {
			s.Rx2 = sol[i].Rx2;
			s.Ry2 = sol[i].Ry2;
		}
		sol2.push_back(s);
	}
	return sol2;
}

double solve_greedy2(vector<Solution>& sol) {
	double score = eval(sol);
	double best_score = score;
	cerr << "initital greedy score = " << score << endl;
	int cnt = 0;
	int w = 1;

	vector<char> takeL1(X - 1, 1);
	vector<char> takeR1(X - 1, 1);
	vector<char> takeL2(X - 1, 1);
	vector<char> takeR2(X - 1, 1);

	for (int i = max(1, Y - 1); i < takeL2.size(); i++) {
		takeL2[i] = 0;
		takeR2[i] = 0;
	}

	vector<char> best_takeL1 = takeL1;
	vector<char> best_takeR1 = takeR1;
	vector<char> best_takeL2 = takeL2;
	vector<char> best_takeR2 = takeR2;
	double st = timer.get();
	double time_interval = (1.98 - st) / 10;
	double next_debug_time = st + time_interval;

	int tt = 2;
	if (Y > 2) {
		tt = 4;
	}

	while (true) {
		double ti = timer.get();
		if (ti > 1.98) break;
		if (ti > next_debug_time) {
			next_debug_time += time_interval;
			cerr << "score = " << score << " best_score = " << best_score << endl;
		}
		double progress = (ti - st) / (2.0 - st);
		double T = 4e4 * (1 - progress);
		cnt++;

		int t = rnd.nextInt(tt);
		int a = rnd.nextInt(X - 1);
		if (t == 0) {
			takeL1[a] = 1 ^ takeL1[a];
		} else if (t == 1) {
			takeR1[a] = 1 ^ takeR1[a];
		} else if (t == 2) {
			takeL2[a] = 1 ^ takeL2[a];
		} else {
			takeR2[a] = 1 ^ takeR2[a];
		}

		vector<Solution> sol2 = construct_sol_from_take(takeL1, takeR1, takeL2, takeR2, sol);

		double nscore = eval(sol2);
		if (nscore > 0 && nscore - score <= -T * rnd.nextLog()) {
			score = nscore;
			if (best_score > score) {
				best_score = score;
				best_takeL1 = takeL1;
				best_takeR1 = takeR1;
				best_takeL2 = takeL2;
				best_takeR2 = takeR2;
			}
		} else {
			if (t == 0) {
				takeL1[a] = 1 ^ takeL1[a];
			} else if (t == 1) {
				takeR1[a] = 1 ^ takeR1[a];
			} else if (t == 2) {
				takeL2[a] = 1 ^ takeL2[a];
			} else {
				takeR2[a] = 1 ^ takeR2[a];
			}
		}
	}
	dump(cnt);
	sol = construct_sol_from_take(best_takeL1, best_takeR1, best_takeL2, best_takeR2, sol);
	cerr << "final greedy score = " << score << endl;
	return score;
}

void solve() {
	vector<Solution> sol;
	int Lx1 = emptyx, Ly1 = emptyy;
	int Rx1 = emptyx, Ry1 = emptyy;
	int Lx2 = emptyx, Ly2 = emptyy;
	int Rx2 = emptyx, Ry2 = emptyy;
	double base_tl = 0.65;
	double tl = base_tl;
	if (Y == 0) tl = 2 * base_tl;
	int obsX[200], obsY[200];
	for (int i = 0; i < Z; i++) {
		obsX[i] = Cx[i];
		obsY[i] = Cy[i];
	}
	for (int i = 0; i < Y; i++) {
		obsX[i + Z] = Bx[i];
		obsY[i + Z] = By[i];
	}
	vector<int> orderA = solve_TSP(Ax, Ay, X, obsX, obsY, Z + Y, tl);
	for (int i = 0; i < X; i++) {
		obsX[i + Z] = Ax[i];
		obsY[i + Z] = Ay[i];
	}
	vector<int> orderB = solve_TSP(Bx, By, Y, obsX, obsY, Z + X, 2 * base_tl);
	for (int i = 0; i < max(X, Y) - 1; i++) {
		Lx1 = Ax[orderA[min(i, X - 2)]];
		Ly1 = Ay[orderA[min(i, X - 2)]];
		Rx1 = Ax[orderA[min(i + 1, X - 1)]];
		Ry1 = Ay[orderA[min(i + 1, X - 1)]];
		if (Y == 0) {
			Lx2 = emptyx;
			Ly2 = emptyy;
			Rx2 = emptyx;
			Ry2 = emptyy;
		} else {
			Lx2 = Bx[orderB[min(i, max(0, Y - 2))]];
			Ly2 = By[orderB[min(i, max(0, Y - 2))]];
			Rx2 = Bx[orderB[min(i + 1, Y - 1)]];
			Ry2 = By[orderB[min(i + 1, Y - 1)]];
		}
		sol.emplace_back(Lx1, Ly1, Rx1, Ry1, Lx2, Ly2, Rx2, Ry2);
	}
	double x = solve_greedy2(sol);

	cerr << "score = " << 1e6 * (1 + log2(1e8 / x)) << endl;

	cerr << "sol.size() = " << sol.size() << endl;
	for (int i = 0; i < sol.size(); i++) {
		cout << sol[i].Lx1 << " " << sol[i].Ly1 << " " << sol[i].Rx1 << " " << sol[i].Ry1 << " "
			 << sol[i].Lx2 << " " << sol[i].Ly2 << " " << sol[i].Rx2 << " " << sol[i].Ry2
			 << '\n';
	}

	cout << flush;
}

void input() {
	cin >> X >> Y >> Z;
	for (int i = 0; i < X; i++) {
		cin >> Ax[i] >> Ay[i];
	}
	for (int i = 0; i < Y; i++) {
		cin >> Bx[i] >> By[i];
	}
	for (int i = 0; i < Z; i++) {
		cin >> Cx[i] >> Cy[i];
	}
}

int main(int argc, char* argv[]) {
	init();
	input();
	solve();
	cerr << "timer = " << timer.get() << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Cooperative Trash Sorting (C)
User ats5515
Language C++ 20 (gcc 12.2)
Score 652518835
Code Size 17263 Byte
Status AC
Exec Time 1982 ms
Memory 4596 KiB

Compile Error

Main.cpp: In member function ‘void FastSet::insert_all()’:
Main.cpp:90:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   90 |                 for (int i = 0; i < list.size(); i++) {
      |                                 ~~^~~~~~~~~~~~~
Main.cpp: In function ‘std::vector<Solution> construct_sol_from_take(std::vector<char>, std::vector<char>, std::vector<char>, std::vector<char>, std::vector<Solution>&)’:
Main.cpp:463:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  463 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp:470:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  470 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp:477:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  477 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp:484:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  484 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp:492:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  492 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp: In function ‘double solve_greedy2(std::vector<Solution>&)’:
Main.cpp:526:39: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  526 |         for (int i = max(1, Y - 1); i < takeL2.size(); i++) {
      |                                     ~~^~~~~~~~~~~~~~~
Main.cpp:519:13: warning: unused variable ‘w’ [-Wunused-variable]
  519 |         int w = 1;
      |             ^
Main.cpp: In function ‘void solve()’:
Main.cpp:644:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Solution>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  644 |         for (int i = 0; i < sol.size(); i++) {
      |                         ~~^~~~~~~~~~~~
Main.cpp: In function ‘int main(int, char**)’:
Main.cpp:666:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
  666 | int main(int argc, char* argv[]) {
      |          ~~~~^~~~
Main.cpp:666:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
  666 | int main(int argc, char* argv[]) {
      |                    ~~~~~~^~~~~~

Judge Result

Set Name test_ALL
Score / Max Score 652518835 / 1500000000
Status
AC × 150
Set Name Test Cases
test_ALL test_0000.txt, test_0001.txt, test_0002.txt, test_0003.txt, test_0004.txt, test_0005.txt, test_0006.txt, test_0007.txt, test_0008.txt, test_0009.txt, test_0010.txt, test_0011.txt, test_0012.txt, test_0013.txt, test_0014.txt, test_0015.txt, test_0016.txt, test_0017.txt, test_0018.txt, test_0019.txt, test_0020.txt, test_0021.txt, test_0022.txt, test_0023.txt, test_0024.txt, test_0025.txt, test_0026.txt, test_0027.txt, test_0028.txt, test_0029.txt, test_0030.txt, test_0031.txt, test_0032.txt, test_0033.txt, test_0034.txt, test_0035.txt, test_0036.txt, test_0037.txt, test_0038.txt, test_0039.txt, test_0040.txt, test_0041.txt, test_0042.txt, test_0043.txt, test_0044.txt, test_0045.txt, test_0046.txt, test_0047.txt, test_0048.txt, test_0049.txt, test_0050.txt, test_0051.txt, test_0052.txt, test_0053.txt, test_0054.txt, test_0055.txt, test_0056.txt, test_0057.txt, test_0058.txt, test_0059.txt, test_0060.txt, test_0061.txt, test_0062.txt, test_0063.txt, test_0064.txt, test_0065.txt, test_0066.txt, test_0067.txt, test_0068.txt, test_0069.txt, test_0070.txt, test_0071.txt, test_0072.txt, test_0073.txt, test_0074.txt, test_0075.txt, test_0076.txt, test_0077.txt, test_0078.txt, test_0079.txt, test_0080.txt, test_0081.txt, test_0082.txt, test_0083.txt, test_0084.txt, test_0085.txt, test_0086.txt, test_0087.txt, test_0088.txt, test_0089.txt, test_0090.txt, test_0091.txt, test_0092.txt, test_0093.txt, test_0094.txt, test_0095.txt, test_0096.txt, test_0097.txt, test_0098.txt, test_0099.txt, test_0100.txt, test_0101.txt, test_0102.txt, test_0103.txt, test_0104.txt, test_0105.txt, test_0106.txt, test_0107.txt, test_0108.txt, test_0109.txt, test_0110.txt, test_0111.txt, test_0112.txt, test_0113.txt, test_0114.txt, test_0115.txt, test_0116.txt, test_0117.txt, test_0118.txt, test_0119.txt, test_0120.txt, test_0121.txt, test_0122.txt, test_0123.txt, test_0124.txt, test_0125.txt, test_0126.txt, test_0127.txt, test_0128.txt, test_0129.txt, test_0130.txt, test_0131.txt, test_0132.txt, test_0133.txt, test_0134.txt, test_0135.txt, test_0136.txt, test_0137.txt, test_0138.txt, test_0139.txt, test_0140.txt, test_0141.txt, test_0142.txt, test_0143.txt, test_0144.txt, test_0145.txt, test_0146.txt, test_0147.txt, test_0148.txt, test_0149.txt
Case Name Status Exec Time Memory
test_0000.txt AC 1981 ms 4596 KiB
test_0001.txt AC 1981 ms 4480 KiB
test_0002.txt AC 1981 ms 4572 KiB
test_0003.txt AC 1981 ms 4564 KiB
test_0004.txt AC 1981 ms 4428 KiB
test_0005.txt AC 1981 ms 4452 KiB
test_0006.txt AC 1981 ms 4476 KiB
test_0007.txt AC 1981 ms 4580 KiB
test_0008.txt AC 1981 ms 4580 KiB
test_0009.txt AC 1981 ms 4588 KiB
test_0010.txt AC 1981 ms 4572 KiB
test_0011.txt AC 1981 ms 4452 KiB
test_0012.txt AC 1981 ms 4428 KiB
test_0013.txt AC 1981 ms 4468 KiB
test_0014.txt AC 1981 ms 4576 KiB
test_0015.txt AC 1981 ms 4452 KiB
test_0016.txt AC 1981 ms 4448 KiB
test_0017.txt AC 1981 ms 4576 KiB
test_0018.txt AC 1981 ms 4468 KiB
test_0019.txt AC 1981 ms 4424 KiB
test_0020.txt AC 1981 ms 4580 KiB
test_0021.txt AC 1981 ms 4572 KiB
test_0022.txt AC 1981 ms 4472 KiB
test_0023.txt AC 1981 ms 4560 KiB
test_0024.txt AC 1981 ms 4576 KiB
test_0025.txt AC 1981 ms 4552 KiB
test_0026.txt AC 1981 ms 4588 KiB
test_0027.txt AC 1981 ms 4580 KiB
test_0028.txt AC 1981 ms 4468 KiB
test_0029.txt AC 1981 ms 4452 KiB
test_0030.txt AC 1981 ms 4580 KiB
test_0031.txt AC 1981 ms 4472 KiB
test_0032.txt AC 1981 ms 4572 KiB
test_0033.txt AC 1981 ms 4420 KiB
test_0034.txt AC 1981 ms 4564 KiB
test_0035.txt AC 1981 ms 4568 KiB
test_0036.txt AC 1981 ms 4448 KiB
test_0037.txt AC 1981 ms 4420 KiB
test_0038.txt AC 1981 ms 4428 KiB
test_0039.txt AC 1981 ms 4476 KiB
test_0040.txt AC 1981 ms 4556 KiB
test_0041.txt AC 1981 ms 4468 KiB
test_0042.txt AC 1981 ms 4548 KiB
test_0043.txt AC 1981 ms 4424 KiB
test_0044.txt AC 1982 ms 4572 KiB
test_0045.txt AC 1981 ms 4572 KiB
test_0046.txt AC 1981 ms 4548 KiB
test_0047.txt AC 1981 ms 4476 KiB
test_0048.txt AC 1981 ms 4576 KiB
test_0049.txt AC 1981 ms 4468 KiB
test_0050.txt AC 1981 ms 4452 KiB
test_0051.txt AC 1981 ms 4588 KiB
test_0052.txt AC 1981 ms 4476 KiB
test_0053.txt AC 1981 ms 4552 KiB
test_0054.txt AC 1981 ms 4556 KiB
test_0055.txt AC 1981 ms 4556 KiB
test_0056.txt AC 1981 ms 4560 KiB
test_0057.txt AC 1981 ms 4480 KiB
test_0058.txt AC 1981 ms 4560 KiB
test_0059.txt AC 1981 ms 4452 KiB
test_0060.txt AC 1981 ms 4556 KiB
test_0061.txt AC 1981 ms 4472 KiB
test_0062.txt AC 1981 ms 4452 KiB
test_0063.txt AC 1981 ms 4552 KiB
test_0064.txt AC 1981 ms 4588 KiB
test_0065.txt AC 1981 ms 4560 KiB
test_0066.txt AC 1981 ms 4456 KiB
test_0067.txt AC 1981 ms 4568 KiB
test_0068.txt AC 1981 ms 4452 KiB
test_0069.txt AC 1981 ms 4464 KiB
test_0070.txt AC 1981 ms 4476 KiB
test_0071.txt AC 1982 ms 4572 KiB
test_0072.txt AC 1981 ms 4472 KiB
test_0073.txt AC 1981 ms 4424 KiB
test_0074.txt AC 1981 ms 4592 KiB
test_0075.txt AC 1981 ms 4568 KiB
test_0076.txt AC 1981 ms 4564 KiB
test_0077.txt AC 1981 ms 4560 KiB
test_0078.txt AC 1981 ms 4596 KiB
test_0079.txt AC 1981 ms 4560 KiB
test_0080.txt AC 1981 ms 4472 KiB
test_0081.txt AC 1981 ms 4472 KiB
test_0082.txt AC 1981 ms 4552 KiB
test_0083.txt AC 1981 ms 4560 KiB
test_0084.txt AC 1981 ms 4456 KiB
test_0085.txt AC 1981 ms 4424 KiB
test_0086.txt AC 1981 ms 4560 KiB
test_0087.txt AC 1981 ms 4448 KiB
test_0088.txt AC 1981 ms 4568 KiB
test_0089.txt AC 1981 ms 4560 KiB
test_0090.txt AC 1981 ms 4572 KiB
test_0091.txt AC 1981 ms 4556 KiB
test_0092.txt AC 1981 ms 4564 KiB
test_0093.txt AC 1981 ms 4552 KiB
test_0094.txt AC 1981 ms 4588 KiB
test_0095.txt AC 1981 ms 4596 KiB
test_0096.txt AC 1981 ms 4572 KiB
test_0097.txt AC 1981 ms 4472 KiB
test_0098.txt AC 1981 ms 4452 KiB
test_0099.txt AC 1981 ms 4428 KiB
test_0100.txt AC 1981 ms 4452 KiB
test_0101.txt AC 1981 ms 4576 KiB
test_0102.txt AC 1981 ms 4592 KiB
test_0103.txt AC 1981 ms 4584 KiB
test_0104.txt AC 1981 ms 4448 KiB
test_0105.txt AC 1981 ms 4468 KiB
test_0106.txt AC 1981 ms 4480 KiB
test_0107.txt AC 1981 ms 4472 KiB
test_0108.txt AC 1981 ms 4592 KiB
test_0109.txt AC 1981 ms 4420 KiB
test_0110.txt AC 1981 ms 4576 KiB
test_0111.txt AC 1981 ms 4472 KiB
test_0112.txt AC 1981 ms 4476 KiB
test_0113.txt AC 1981 ms 4592 KiB
test_0114.txt AC 1981 ms 4552 KiB
test_0115.txt AC 1981 ms 4464 KiB
test_0116.txt AC 1981 ms 4564 KiB
test_0117.txt AC 1981 ms 4584 KiB
test_0118.txt AC 1981 ms 4588 KiB
test_0119.txt AC 1981 ms 4476 KiB
test_0120.txt AC 1981 ms 4568 KiB
test_0121.txt AC 1981 ms 4476 KiB
test_0122.txt AC 1981 ms 4452 KiB
test_0123.txt AC 1981 ms 4472 KiB
test_0124.txt AC 1981 ms 4576 KiB
test_0125.txt AC 1981 ms 4584 KiB
test_0126.txt AC 1981 ms 4452 KiB
test_0127.txt AC 1981 ms 4592 KiB
test_0128.txt AC 1981 ms 4572 KiB
test_0129.txt AC 1981 ms 4584 KiB
test_0130.txt AC 1981 ms 4588 KiB
test_0131.txt AC 1981 ms 4548 KiB
test_0132.txt AC 1981 ms 4480 KiB
test_0133.txt AC 1981 ms 4476 KiB
test_0134.txt AC 1981 ms 4472 KiB
test_0135.txt AC 1981 ms 4552 KiB
test_0136.txt AC 1981 ms 4576 KiB
test_0137.txt AC 1981 ms 4592 KiB
test_0138.txt AC 1981 ms 4576 KiB
test_0139.txt AC 1981 ms 4456 KiB
test_0140.txt AC 1981 ms 4564 KiB
test_0141.txt AC 1981 ms 4456 KiB
test_0142.txt AC 1981 ms 4572 KiB
test_0143.txt AC 1981 ms 4464 KiB
test_0144.txt AC 1981 ms 4572 KiB
test_0145.txt AC 1981 ms 4448 KiB
test_0146.txt AC 1981 ms 4588 KiB
test_0147.txt AC 1981 ms 4480 KiB
test_0148.txt AC 1981 ms 4472 KiB
test_0149.txt AC 1981 ms 4456 KiB