Submission details
Task:Hamilton
Sender:jsesok
Submission time:2026-08-24 20:46:41 +0300
Language:C++ (C++23)
Status:READY
Result:0
Feedback
subtaskverdictscore
#10
#20
#30
#40
Test results
testverdicttimescoresubtask
#10.01 s0details
#20.01 s01details
#30.01 s02, 3details
#40.01 s04details

Code

#include <iostream>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
using namespace std;
int main() {
  /*  ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(0);*/
    int n, t, s;
    char c;
    cin>>n>>t;
    vector<vector<int>> a(n, vector<int> (n, 0));
    for (int i=0; i<n; ++i)
    {
        a[i][(i+1)%n]=1;
        for (int j=0; j<i-1; ++j)
            a[i][j]=1;
    }
    for (int i=0; i<n; ++i)
    {
        for (int j=0; i<n; ++j)
            cout<<a[i][j];
        cout<<endl;
    }
    for (int i=0; i<t; ++i)
    {
        vector<vector<int>> g(n, vector<int> (n, 0));
        vector<pair<int, int>> kol;
        for (int i=0; i<n; ++i)
        {
            s=0;
            for (int j=i+1; j<n; ++j)
            {
                cout<<"? "<<i+1<<" "<<j+1<<endl;
                cin>>c;
                if (c=='>')
                {
                    s+=1;
                    g[i][j]=1;
                }
                else
                {
                    g[j][i]=1;
                }
            }
            kol.push_back({s, i});
        }
        sort(kol.begin(), kol.end());
        if (g[kol[0].second][kol[1].second]==0)
            swap(kol[0], kol[1]);
        if (g[kol[n-2].second][kol[n-1].second]==0)
            swap(kol[n-2], kol[n-1]);
        cout<<"!";
        for (int i=0; i<n; ++i)
            cout<<" "<<kol[i].second+1;
        cout<<endl;
    }
    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
010000330001000330100100330110...

Feedback: Invalid character in graph description51.

Test 2

Subtask: 1

Verdict:

input
01 4 200 rnd

correct output
(empty)

user output
Activating encoder mode
4 200
010000330001000330100100330110...

Feedback: Invalid character in graph description51.

Test 3

Subtask: 2, 3

Verdict:

input
02 50 200 rnd

correct output
(empty)

user output
Activating encoder mode
50 200
010000000000000000000000000000...

Feedback: Invalid character in graph description50.

Test 4

Subtask: 4

Verdict:

input
03 500 200 rnd

correct output
(empty)

user output
Activating encoder mode
500 200
010000000000000000000000000000...

Feedback: Invalid character in graph description50.