Submission #734724

#TimeUsernameProblemLanguageResultExecution timeMemory
734724QweszBank (IZhO14_bank)C++14
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int n, m, inp[20], bank[20]; int main{ cin >> n >> m; for(int i = 0; i < n; i++) cin >> inp[i]; for(int i = 0; i < m; i++) cin >> bank[i]; cout << "YES" << endl; }

Compilation message (stderr)

bank.cpp:6:5: error: cannot declare '::main' to be a global variable
    6 | int main{
      |     ^~~~
bank.cpp:7:16: error: expected '}' before ';' token
    7 |   cin >> n >> m;
      |                ^
bank.cpp:6:9: note: to match this '{'
    6 | int main{
      |         ^
bank.cpp:7:12: error: invalid user-defined conversion from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' [-fpermissive]
    7 |   cin >> n >> m;
      |   ~~~~~~~~~^~~~
In file included from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from bank.cpp:1:
/usr/include/c++/10/bits/basic_ios.h:117:16: note: candidate is: 'std::basic_ios<_CharT, _Traits>::operator bool() const [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  117 |       explicit operator bool() const
      |                ^~~~~~~~
/usr/include/c++/10/bits/basic_ios.h:117:16: note:   return type 'bool' of explicit conversion function cannot be converted to 'int' with a qualification conversion
bank.cpp:8:4: error: expected unqualified-id before 'for'
    8 |    for(int i = 0; i < n; i++) cin >> inp[i];
      |    ^~~
bank.cpp:8:19: error: 'i' does not name a type
    8 |    for(int i = 0; i < n; i++) cin >> inp[i];
      |                   ^
bank.cpp:8:26: error: 'i' does not name a type
    8 |    for(int i = 0; i < n; i++) cin >> inp[i];
      |                          ^
bank.cpp:9:4: error: expected unqualified-id before 'for'
    9 |    for(int i = 0; i < m; i++) cin >> bank[i];
      |    ^~~
bank.cpp:9:19: error: 'i' does not name a type
    9 |    for(int i = 0; i < m; i++) cin >> bank[i];
      |                   ^
bank.cpp:9:26: error: 'i' does not name a type
    9 |    for(int i = 0; i < m; i++) cin >> bank[i];
      |                          ^
bank.cpp:10:3: error: 'cout' does not name a type
   10 |   cout << "YES" << endl;
      |   ^~~~
bank.cpp:11:1: error: expected declaration before '}' token
   11 | }
      | ^