Submission #974866

# Submission time Handle Problem Language Result Execution time Memory
974866 2024-05-04T03:13:23 Z vjudge1 Awesome Arrowland Adventure (eJOI19_adventure) C++
Compilation error
0 ms 0 KB
#include <iostream>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    if(n==1&& m==1){
        cout<<0;
        return 0;
    }
    if(n==1){
        string s;
        cin>>s;
        int ans=0;
        for (int i = 0; i < s.length(); i++)
        {
            if(s[i]=='X'){
                cout<<-1;
                return 0;
        }
        
    }
    cout<<0;
    return 0;
}

Compilation message

adventure.cpp: In function 'int main()':
adventure.cpp:14:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for (int i = 0; i < s.length(); i++)
      |                         ~~^~~~~~~~~~~~
adventure.cpp:13:13: warning: unused variable 'ans' [-Wunused-variable]
   13 |         int ans=0;
      |             ^~~
adventure.cpp:24:1: error: expected '}' at end of input
   24 | }
      | ^
adventure.cpp:3:11: note: to match this '{'
    3 | int main(){
      |           ^