제출 #1364547

#제출 시각아이디문제언어결과실행 시간메모리
1364547biserailievaLight Bulbs (EGOI24_lightbulbs)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>

int main()
{
    int n;
    cin>>n;
    string komb[3]={"100", "010", "001"};
    cout<<"?"<<endl;
    cout<<"111"<<endl;
    cout<<"000"<<endl;
    cout<<"000"<<endl;
    int x;
    cin>>x;
    if(x==n*n)
    {
        cout<<"!"<<endl;
        cout<<"111"<<endl;
        cout<<"000"<<endl;
        cout<<"000"<<endl;
        return 0;
    }
    cout<<"?"<<endl;
    cout<<"000"<<endl;
    cout<<"111"<<endl;
    cout<<"000"<<endl;
    cin>>x;
    if(x==n*n)
    {
        cout<<"!"<<endl;
        cout<<"000"<<endl;
        cout<<"111"<<endl;
        cout<<"000"<<endl;
        return 0;
    }
    cout<<"?"<<endl;
    cout<<"000"<<endl;
    cout<<"000"<<endl;
    cout<<"111"<<endl;
    cin>>x;
    if(x==n*n)
    {
        cout<<"!"<<endl;
        cout<<"000"<<endl;
        cout<<"000"<<endl;
        cout<<"111"<<endl;
        return 0;
    }
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                cout<<"?"<<endl;
                cout<<komb[i]<<endl;
                cout<<komb[j]<<endl;
                cout<<komb[k]<<endl;
                cin>>x;
                if(x==n*n)
                {
                    cout<<"!"<<endl;
                    cout<<komb[i]<<endl;
                    cout<<komb[j]<<endl;
                    cout<<komb[k]<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}



컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin>>n;
      |     ^~~
      |     std::cin
In file included from Main.cpp:1:
/usr/include/c++/13/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Main.cpp:7:5: error: 'string' was not declared in this scope
    7 |     string komb[3]={"100", "010", "001"};
      |     ^~~~~~
Main.cpp:7:5: note: suggested alternatives:
In file included from /usr/include/c++/13/iosfwd:41,
                 from /usr/include/c++/13/ios:40,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41:
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44:
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
Main.cpp:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     cout<<"?"<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/13/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Main.cpp:8:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |     cout<<"?"<<endl;
      |                ^~~~
      |                std::endl
/usr/include/c++/13/ostream:735:5: note: 'std::endl' declared here
  735 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Main.cpp:55:23: error: 'komb' was not declared in this scope
   55 |                 cout<<komb[i]<<endl;
      |                       ^~~~