제출 #1230214

#제출 시각아이디문제언어결과실행 시간메모리
1230214Ludissey분수 공원 (IOI21_parks)C++20
컴파일 에러
0 ms0 KiB
for (int i = 0; i < n; i++)
    {
        if(sz(neigh[i])!=2) continue;
        int _x=x[i];
        int _y=y[i];
        for (auto u : neigh[i])
        {
            if(a[u.first]>=0) continue;

            if(u.second==0){
                if(st.find({_x-1,_y-1})==st.end()){
                    st.insert({_x-1,_y-1});
                    a[u.first]=_x-1;
                    b[u.first]=_y-1;
                }else{
                    st.insert({_x-1,_y+1});
                    a[u.first]=_x-1;
                    b[u.first]=_y+1;
                }
            }else if(u.second==1){
                if(st.find({_x-1,_y-1})==st.end()){
                    st.insert({_x-1,_y-1});
                    a[u.first]=_x-1;
                    b[u.first]=_y-1;
                }else{
                    st.insert({_x+1,_y-1});
                    a[u.first]=_x+1;
                    b[u.first]=_y-1;
                }
            }else if(u.second==2){
                if(st.find({_x-1,_y+1})==st.end()){
                    st.insert({_x-1,_y+1});
                    a[u.first]=_x-1;
                    b[u.first]=_y+1;
                }else{
                    st.insert({_x+1,_y+1});
                    a[u.first]=_x+1;
                    b[u.first]=_y+1;
                }
            }else{
                if(st.find({_x+1,_y-1})==st.end()){
                    st.insert({_x+1,_y-1});
                    a[u.first]=_x+1;
                    b[u.first]=_y-1;
                }else{
                    st.insert({_x+1,_y+1});
                    a[u.first]=_x+1;
                    b[u.first]=_y+1;
                }
            }
        }
    } 

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

parks.cpp:1:1: error: expected unqualified-id before 'for'
    1 | for (int i = 0; i < n; i++)
      | ^~~
parks.cpp:1:21: error: 'n' was not declared in this scope
    1 | for (int i = 0; i < n; i++)
      |                     ^
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:21: error: 'n' was not declared in this scope
parks.cpp:1:17: error: 'i' does not name a type
    1 | for (int i = 0; i < n; i++)
      |                 ^
parks.cpp:1:24: error: 'i' does not name a type
    1 | for (int i = 0; i < n; i++)
      |                        ^