| Task: | Hamilton |
| Sender: | jsesok |
| Submission time: | 2026-04-17 14:49:10 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 0 |
| subtask | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| #4 | WRONG ANSWER | 0 |
| test | verdict | time | score | subtask | |
|---|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | 0 | details | |
| #2 | WRONG ANSWER | 0.01 s | 0 | 1 | details |
| #3 | WRONG ANSWER | 0.04 s | 0 | 2, 3 | details |
| #4 | WRONG ANSWER | 0.32 s | 0 | 4 | details |
Code
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <queue>
#include <climits>
#include <map>
#include <unordered_map>
#include <stack>
using namespace std;
int x=-1;
void f(int n, vector<pair<int, int>> &a, vector<vector<int>> &b, pair<int, int> p, int d)
{
if (x!=-1)
return;
a[d]=p;
for (int i : b[d])
{
if (a[i]==make_pair(-1, -1))
f(n, a, b, {a[i].first+1, d}, i);
else if (a[i].first==1)
{
x=d;
stack<int> s;
while (x!=-1)
{
s.push(x);
x=a[x].second;
}
x=0;
cout<<"!";
while (!s.empty())
{
cout<<" "<<s.top()+1;
s.pop();
}
cout<<endl;
return ;
}
}
}
int main()
{
/* ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);*/
int n, t;
cin>>n>>t;
string a;
char c;
for (int i=0; i<n; ++i)
{
for (int j=0; j<n; ++j)
{
if (((1+i)%n==j || i<=j) && j!=(i-1+n)%n && i!=j)
cout<<1;
else
cout<<0;
}
cout<<endl;
}
while (t--)
{
cout<<endl;
x=-1;
vector<vector<int>> b(n);
for (int i=1; i<=n; ++i)
{
for (int j=i+1; j<=n; ++j)
{
cout<<"? "<<i<<" "<<j<<endl;
cin>>c;
if (c=='>')
{
b[i-1].push_back(j-1);
}
else
{
b[j-1].push_back(i-1);
}
}
}
for (int i=0; i<n; ++i)
{
vector<pair<int, int>> d(n, {-1, -1});;
f(n, d, b, {1, -1}, i);
}
}
return 0;
}
Test details
Test 1
Subtask:
Verdict: WRONG ANSWER
| input |
|---|
| 0 5 2 fixed 1 2 3 4 5 2 4 1 5 ... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 5 2 01110 00111 00011 ... |
Feedback: Formatting error
Test 2
Subtask: 1
Verdict: WRONG ANSWER
| input |
|---|
| 01 4 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 4 200 0110 0011 0001 ... |
Feedback: Formatting error
Test 3
Subtask: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 02 50 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 50 200 011111111111111111111111111111... |
Feedback: Formatting error
Test 4
Subtask: 4
Verdict: WRONG ANSWER
| input |
|---|
| 03 500 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 500 200 011111111111111111111111111111... |
Feedback: Case #1: Too many queries
