Submission #1230214

#TimeUsernameProblemLanguageResultExecution timeMemory
1230214LudisseyFountain Parks (IOI21_parks)C++20
Compilation error
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;
                }
            }
        }
    } 

Compilation message (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++)
      |                        ^