| Task: | Hamilton |
| Sender: | Juan_Alejandro |
| Submission time: | 2026-04-17 10:59:49 +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.03 s | 0 | 2, 3 | details |
| #4 | WRONG ANSWER | 0.32 s | 0 | 4 | details |
Compiler report
input/code.cpp: In function 'void dfs(long long int, std::vector<std::vector<long long int> >&, std::vector<bool>&, std::vector<bool>&, long long int, bool&)':
input/code.cpp:22:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int v=1;v<x.size();v++)
| ~^~~~~~~~~
input/code.cpp:38:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int v=1;v<x.size();v++)
| ~^~~~~~~~~
input/code.cpp:51:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | if(c==x.size()-1-1&&query(u,1))
| ~^~~~~~~~~~...Code
#include <bits/stdc++.h>
#define int long long
//#define endl " \n"
#define vec vector
#define all(x) x.begin(),x.end()
#pragma GCC optimize("O2,unroll-loops")
using namespace std;
bool query(int u,int v)
{
cout<<"? "<<u<<" "<<v<<endl;
char c;
cin>>c;
return c=='>';
}
stack<int> res;
void dfs(int u,vec<vec<int>> &x,vec<bool> &vis,vec<bool> &viss2,int d,bool &enc)
{
if(!d)
vis[u]=1;else
viss2[u]=1;
int allv=x.size();
for(int v=1;v<x.size();v++)
{
if(vis[v])allv--;
if((!vis[v])&&query(u,v))
{
dfs(v,x,vis,viss2,0,enc);
if(enc)
{
res.push(u);
return;
}
}
}
allv=!allv;
int c=0;
if(allv)
for(int v=1;v<x.size();v++)
{
if(viss2[v])c++;
if(v!=1&&(!viss2[v])&&query(u,v))
{
dfs(v,x,vis,viss2,1,enc);
if(enc)
{
res.push(u);
return;
}
}
}
if(c==x.size()-1-1&&query(u,1))
{
enc=1;
res.push(1);
res.push(u);
return;
}
}
int32_t main()
{
/*ios::sync_with_stdio(false);
cin.tie(nullptr);*/
int n,t;
cin>>n>>t;
vec<vec<int>> g(n,vec<int>(n));
for (int i = 0; i < n; i++)
{
for (int j = i+1; j < n; j++)
{
g[i][j]=!g[j][i];
}cout<<endl;
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cout<<g[i][j];
}cout<<endl;
}
while(t--)
{
vec<bool> vis(n+1,0);
vec<bool> viss2(n+1,0);
bool enc=0;
dfs(1,g,vis,viss2,0,enc);
cout<<"! ";
while(!res.empty())
{
cout<<res.top()<<" ";
res.pop();
}cout<<endl;
}
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 ... |
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 ... |
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 ... |
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 ... |
Feedback: Case #1: Too many queries
