Submission #5915

# Submission time Handle Problem Language Result Execution time Memory
5915 2014-05-23T01:43:05 Z gs12037 토마토 (KOI13_tomato) C++
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <deque>
 
using namespace std;
 
int a[1010][1010];
int x[5]={0,1,0,-1,0};
deque<int> v1,v2;
 
int main()
{
    int m,n,i,j,t=-1;
    scanf("%d%d",&m,&n);
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
        {
            scanf("%d",&a[i][j]);
            if(a[i][j]==1)
            {
                v1.push_back(i);
                v2.push_back(j);
            }
            else
                a[i][j]--;
        }
    while(v1.size()!=0)
    {
        int s=v1.size();
        for(i=0;i<s;i++)
        {
            for(int k=0;k<=3;k++)
            {
                if(a[v1.front()+x[k]][v2.front()+x[k+1]]==-1)
                {
                    a[v1.front()+x[k]][v2.front()+x[k+1]]++;
                    v1.push_back(v1.front()+x[k]);
                    v2.push_back(v2.front()+x[k+1]);
                }
            }
            v1.pop_front();
            v2.pop_front();
        }
        t++;    
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            if(a[i][j]==-1)
                break;
            }
        }
        if (a[i][[j]==-1) break;
    }
    if(i==n+1 && j==m+1)
        printf("%d",t);
    else
        printf("-1");
}

Compilation message

tomato.cpp: In lambda function:
tomato.cpp:51:21: error: expected '{' before '==' token
tomato.cpp: In function 'int main()':
tomato.cpp:51:21: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
tomato.cpp:51:24: error: no match for 'operator==' in '{j} == -0x00000000000000001'
tomato.cpp:51:24: note: candidates are:
/usr/include/c++/4.6/bits/stl_pair.h:201:5: note: template<class _T1, class _T2> bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
/usr/include/c++/4.6/bits/stl_iterator.h:285:5: note: template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
/usr/include/c++/4.6/bits/stl_iterator.h:335:5: note: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&)
/usr/include/c++/4.6/bits/allocator.h:122:5: note: template<class _T1, class _T2> bool std::operator==(const std::allocator<_T1>&, const std::allocator<_T2>&)
/usr/include/c++/4.6/bits/allocator.h:127:5: note: template<class _Tp> bool std::operator==(const std::allocator<_Tp1>&, const std::allocator<_Tp1>&)
/usr/include/c++/4.6/bits/stl_deque.h:246:5: note: template<class _Tp, class _Ref, class _Ptr> bool std::operator==(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)
/usr/include/c++/4.6/bits/stl_deque.h:253:5: note: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> bool std::operator==(const std::_Deque_iterator<_Tp, _RefL, _PtrL>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&)
/usr/include/c++/4.6/bits/stl_deque.h:1917:5: note: template<class _Tp, class _Alloc> bool std::operator==(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)
tomato.cpp:51:25: error: expected ']' before ')' token
tomato.cpp:51:27: error: break statement not within loop or switch
tomato.cpp: At global scope:
tomato.cpp:53:5: error: expected unqualified-id before 'if'
tomato.cpp:55:5: error: expected unqualified-id before 'else'
tomato.cpp:57:1: error: expected declaration before '}' token
tomato.cpp: In function 'int main()':
tomato.cpp:13:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
tomato.cpp:17:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]