Submission #119839

# Submission time Handle Problem Language Result Execution time Memory
119839 2019-06-22T13:39:52 Z keko37 Meetings (JOI19_meetings) C++14
17 / 100
984 ms 1356 KB
#include <bits/stdc++.h>
#include "meetings.h"


using namespace std;

int n;

void rjesi (vector <int> v) {
	if (v.size() < 2) return;
	random_shuffle(v.begin(), v.end());
	int a = v[0], b = v[1];
	vector <int> lef, rig;
	lef.push_back(a); rig.push_back(b);
	for (int i=2; i<v.size(); i++) {
		//cout << "pikam " << a << " " << b << " " << v[i] << endl;
		if (v[i] == a || v[i] == b) continue;
		assert(a != b);
		int val = Query(a, b, v[i]);
		if (val == a) {
			lef.push_back(v[i]);
		} else if (val == b) {
		 	rig.push_back(v[i]);
		} else {
			if (lef.size() < rig.size()) {
				a = val;
				lef.push_back(val);
				if (v[i] != val) lef.push_back(v[i]);
			} else {
				b = val;
				rig.push_back(val);
				if (v[i] != val) rig.push_back(v[i]);
			}
		}
	}
	if (a > b) swap(a, b);
	//cout << "naso sam " << a << " " << b << endl;
	//cout << "lef je "; for (auto x : lef) cout << x << " "; cout << endl;
	//cout << "rig je "; for (auto x : rig) cout << x << " "; cout << endl;
	Bridge(a, b);
	rjesi(lef);
	rjesi(rig);
}

void Solve (int N) {
	n = N;
	vector <int> e;
	for (int i=0; i<n; i++) {
		e.push_back(i);
	}
	rjesi(e);
}

Compilation message

meetings.cpp: In function 'void rjesi(std::vector<int>)':
meetings.cpp:15:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=2; i<v.size(); i++) {
                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 984 ms 860 KB Output is correct
2 Runtime error 691 ms 1356 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -