QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#34749#4251. Gamemantlemoose#Compile Error//C++141.5kb2022-06-12 06:50:062024-05-26 00:55:29

Judging History

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

  • [2024-05-26 00:55:29]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-12 06:50:06]
  • 提交

answer

#include "game.h"
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <string.h>
#include <utility>
#include <map>
#include <list>
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second

const int maxn = 3e5 + 10;

int n, k;
int to[maxn], frm[maxn];
vector <int> g1[maxn], g2[maxn];

void init(int N, int K) {
	n = N;
	k = K;
	for (int i = k; i < n; i++) {
		to[i] = n;
		frm[i] = -1;
	}
}

void set_frm(int u, int val) {
	frm[u] = val;
	for (int v : g1[u]) {
		if (frm[v] >= val) continue;
		set_frm(v, val);
	}
}

void set_to(int u, int val) {
	to[u] = val;
	for (int v : g2[u]) {
		if (to[v] <= val) continue;
		set_to(v, val);
	}
}

int add_teleporter(int u, int v) {
	g1[u].pb(v);
	g2[v].pb(u);
	if (u < k && v < k) {
		if (u >= v) return 1;
	}
	else {
		if (u < k) {
			if (to[v] <= u) return 1;
			set_frm(v, u);
		}
		else if (v < k) {
			if (frm[u] >= v) return 1;
			set_to(u, v);
		}
		else {
			if (frm[u] >= to[v]) return 1;
			set_frm(v, frm[u]);
			set_to(u, to[v]);
		}
	}
	return 0;
}

int main() {
	// init(6, 3);
	// cout << add_teleporter(3, 4) << endl;
	// cout << add_teleporter(5, 0) << endl;
	// cout << add_teleporter(4, 5) << endl;
	// cout << add_teleporter(5, 3) << endl;
	// cout << add_teleporter(1, 4) << endl;
	// for (int i = 0; i < n; i++) cout << frm[i] << ' ' << to[i] << endl;
}

Details

/usr/bin/ld: /tmp/ccnKRP5M.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccCF9CBL.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status