| Task: | Hamilton |
| Sender: | Lia_Cruz |
| Submission time: | 2026-04-17 13:21:39 +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.01 s | 0 | 2, 3 | details |
| #4 | WRONG ANSWER | 0.03 s | 0 | 4 | details |
Code
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>
#define vvi vector<vector<int>>
#define sz(x) x.size()
#define all(x) (x).begin(), x.end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e18;
const int MOD = 1e9 + 7;
int32_t main(){
cin.tie(0)->sync_with_stdio(0);
cout.precision(0);
cout << fixed;
int n, t;
cin>>n>>t;
for(int i = 0; n > i; i++){
string s(n, '0');
for(int j = 0; n > j; j++){
if(i == j){
continue;
}
if(i == n - 1 && j == 0){
s[j] = '1';
}
else if(j > i){
s[j] = '1';
}
}
cout<<s<<endl;
}
auto f = [&](int x, int y){
cout<<"? "<<x<<" "<<y<<endl;
char c;
cin>>c;
return c;
};
while(t--){
vi deg(n + 1);
vector<vector<char>> g(n + 1, vector<char>(n + 1));
for(int i = 1; n >= i; i++){
for(int j = i + 1; n >= j; j++){
char c = f(i, j);
if(c == '>'){
g[i][j] = 1;
g[j][i] = 0;
deg[i]++;
}
else{
g[i][j] = 0;
g[j][i] = 1;
deg[j]++;
}
}
}
vi o(n);
iota(all(o), 1);
sort(all(o), [&](int x, int y){
if(deg[x] != deg[y]){
return deg[x] > deg[y];
}
return y > x;
});
for(int i = 0; n > i;){
int j = i;
while(n > j && deg[o[j]] == deg[o[i]]){
j++;
}
if(j - i == 2){
int x = o[i], y = o[i + 1];
if(!g[x][y]){
swap(o[i], o[i + 1]);
}
}
i = j;
}
cout<<"! ";
for(auto x : o){
cout<<x<<" ";
}
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 01111 00111 00011 ... |
Feedback: Duplicate or missing edge in given graph
Test 2
Subtask: 1
Verdict: WRONG ANSWER
| input |
|---|
| 01 4 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 4 200 0111 0011 0001 ... |
Feedback: Duplicate or missing edge in given graph
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: Duplicate or missing edge in given graph
Test 4
Subtask: 4
Verdict: WRONG ANSWER
| input |
|---|
| 03 500 200 rnd |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 500 200 011111111111111111111111111111... |
Feedback: Duplicate or missing edge in given graph
