| Task: | Hamilton |
| Sender: | jsesok |
| Submission time: | 2026-04-17 13:44:51 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 0 |
| subtask | verdict | score |
|---|---|---|
| #1 | TIME LIMIT EXCEEDED | 0 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| #4 | WRONG ANSWER | 0 |
| test | verdict | time | score | subtask | |
|---|---|---|---|---|---|
| #1 | TIME LIMIT EXCEEDED | -- | 0 | details | |
| #2 | TIME LIMIT EXCEEDED | -- | 0 | 1 | details |
| #3 | TIME LIMIT EXCEEDED | -- | 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 main()
{
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int n, t, x;
cin>>n>>t;
string a;
char c;
for (int i=0; i<n; ++i)
{
for (int j=0; j<n; ++j)
{
if (j<=i)
cout<<0;
else
cout<<1;
}
cout<<endl;
}
while (--t)
{
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);
}
}
}
vector<pair<int, int>> d(n);
for (int i=0; i<n; ++i)
{
queue<int> q;
for (int j=0; j<n; ++j)
d[j]={-1, -1};
d[i]={1, -1};
q.push(i);
x=-1;
while (!q.empty())
{
for (int j : b[q.front()])
{
if (d[j].first==1 && d[q.front()].first==n)
{
x=q.front();
break;
}
if (d[j].first==-1)
{
d[j]={d[q.front()].first+1, q.front()};
}
}
if (x!=-1)
break;
}
if (x!=-1)
break;
}
cout<<"!";
stack<int> s;
while (d[x].second!=-1)
{
s.push(x);
x=d[x].second;
}
while (!s.empty())
cout<<" "<<s.top();
cout<<endl;
}
return 0;
}
Test details
Test 1
Subtask:
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 0 5 2 fixed 1 2 3 4 5 2 4 1 5 ... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 2
Subtask: 1
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 01 4 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 3
Subtask: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 02 50 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
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
