Submission #144148

# Submission time Handle Problem Language Result Execution time Memory
144148 2019-08-16T08:15:22 Z emilem Izlet (COI19_izlet) C++14
25 / 100
1288 ms 36904 KB
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;

vector< vector<int> > a;

void Solve1()
{
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	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:35: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 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 644 ms 35832 KB Output is correct
2 Correct 608 ms 36600 KB Output is correct
3 Correct 1210 ms 36856 KB Output is correct
4 Correct 1288 ms 36904 KB Output is correct
5 Correct 609 ms 36856 KB Output is correct
6 Correct 704 ms 36600 KB Output is correct
7 Correct 505 ms 26596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -