Submission #1151847

#TimeUsernameProblemLanguageResultExecution timeMemory
1151847Muhammad_AneeqLight Bulbs (EGOI24_lightbulbs)C++20
0 / 100
0 ms416 KiB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
#include <vector>
#include <map>
#warning check the output
using namespace std;
int n;
int const N=110;
int gr[N][N];
int ask(vector<pair<int,int>>x)
{
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
            gr[i][j]=0;
    for (auto [i,j]:x)
        gr[i][j]=1;
    cout<<"?\n";
    for (int j=0;j<n;j++)
    {
        for (int k=0;k<n;k++)
        {
            cout<<gr[j][k];
        }
        cout<<'\n';
    }
    int z;
    cin>>z;
    return z;
}
void ans(vector<pair<int,int>>x)
{
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
            gr[i][j]=0;
    for (auto [i,j]:x)
        gr[i][j]=1;
    cout<<"!\n";
    for (int j=0;j<n;j++)
    {
        for (int k=0;k<n;k++)
        {
            cout<<gr[j][k];
        }
        cout<<'\n';
    }
}
inline void solve()
{
    cin>>n;
    int z=ask({{0,1},{0,0}});
    int y=ask({{0,0},{1,0}});
    char d;
    if (z!=2*n-1)
    {
        if (z==2*n)
            d='v';
        else
            d='h';
    }
    else
    {
        if (y==2*n)
            d='h';
        else
            d='v';
    }
    if (d=='v')
    {
        vector<pair<int,int>>d={{0,0}};
        // map<int,int>bk;
        // bk[0]=1;
        for (int j=1;j<n;j++)
        {
            for (int i=0;i<n;i++)
            {
                    int z=ask({{0,0},{i,j}});
                    if (z==2*n)
                    {
                        d.push_back({i,j});
                        break;
                    }
            }
        }
        ans(d);
    }
    else
    {
        vector<pair<int,int>>d={{0,0}};
        for (int i=1;i<n;i++)
        {
            for (int j=0;j<n;j++)
            {
                int z=ask({{0,0},{i,j}});
                if (z==2*n)
                {
                    d.push_back({i,j});
                    break;
                }
            }
        }
        ans(d);
    }
}
int main()
{
    int t=1;
    for (int i=1;i<=t;i++)
    {
        solve();
    }
}

Compilation message (stderr)

Main.cpp:10:2: warning: #warning check the output [-Wcpp]
   10 | #warning check the output
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...