Submission details
Task:Hamilton
Sender:Lia_Cruz
Submission time:2026-04-17 11:43:12 +0300
Language:C++ (C++20)
Status:READY
Result:5
Feedback
subtaskverdictscore
#1ACCEPTED5
#20
#30
#40
Test results
testverdicttimescoresubtask
#10.01 s0details
#2ACCEPTED0.04 s1001details
#30.01 s02, 3details
#40.01 s04details

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;

int32_t main(){
    cin.tie(0) -> sync_with_stdio(0);
    cout.tie(0); cout<<fixed;

    int n, t;
    cin>>n>>t;

    vector<string> g = {
        "0110",
        "0011",
        "0001",
        "1000"
    };

    for(auto x : g){
        cout<<x<<endl;
    }

    while(t--){
        vector<vector<bool>> b(5, vector<bool> (5));

        for(int i = 1; 4 >= i; i++){
            for(int j = i + 1; 4 >= j; j++){
                cout<<"? "<<i<<" "<<j<<endl;

                char c; cin>>c;

                if(c == '>'){
                    b[i][j] = 1;
                }
                else{
                    b[j][i] = 1;
                }
            }
        }

        vi p = {1, 2, 3, 4};
        do{
            bool ok = 1;
            for(int i = 0; 3 > i; i++){
                if(!b[p[i]][p[i + 1]]){
                    ok = 0;
                }
            }

            if(!b[p[3]][p[0]]){
                ok = 0;
            }

            if(ok){
                cout<<"! ";
                for(int i = 0; 4 > i; i++){
                    cout<<p[i]<<" ";
                }
                cout<<endl;
                break;
            }
        }while(next_permutation(all(p)));
    }



    return 0;
}

Test details

Test 1

Subtask:

Verdict:

input
0 5 2 fixed 1 2 3 4 5 2 4 1 5 ...

correct output
(empty)

user output
Activating encoder mode
5 2
0110
0011
0001
...

Feedback: Self-loop

Test 2

Subtask: 1

Verdict: ACCEPTED

input
01 4 200 rnd

correct output
(empty)

user output
Activating encoder mode
4 200
0110
0011
0001
...

Feedback: Q = 6.000000

Test 3

Subtask: 2, 3

Verdict:

input
02 50 200 rnd

correct output
(empty)

user output
Activating encoder mode
50 200
0110
0011
0001
...

Feedback: Invalid character in graph description63.

Test 4

Subtask: 4

Verdict:

input
03 500 200 rnd

correct output
(empty)

user output
Activating encoder mode
500 200
0110
0011
0001
...

Feedback: Invalid character in graph description63.