Submission #144147

# Submission time Handle Problem Language Result Execution time Memory
144147 2019-08-16T08:14:11 Z emilem Izlet (COI19_izlet) C++14
0 / 100
2000 ms 35704 KB
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;

vector< vector<int> > a;

void Solve1()
{
}
int main()
{
	int subTask;
	cin >> subTask;
	int n;
	cin >> n;
	a.resize(n, vector<int>(n));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];
	if (subTask == 1)
		/*Solve1()*/;
	vector<int> ans(n, -1);
	ans[0] = 1;
	for (int i = 1; i < n; ++i)
	{
		set<int> s;
		for (int j = i - 1; j >= 0; --j)
		{
			s.insert(ans[j]);
			if (s.size() == a[j][i])
			{
				ans[i] = ans[j];
				break;
			}
		}
		if (ans[i] == -1)
			ans[i] = *max_element(ans.begin(), ans.begin() + i) + 1;
	}
	for (int i = 0; i < n; ++i)
		cout << ans[i] << ' ';
	cout << endl;
	for (int i = 1; i < n; ++i)
		cout << i << ' ' << i + 1 << '\n';

	char I;
	cin >> I;
}

Compilation message

izlet.cpp: In function 'int main()':
izlet.cpp:32:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (s.size() == a[j][i])
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2044 ms 35704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -