# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144147 | emilem | Izlet (COI19_izlet) | C++14 | 2044 ms | 35704 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |