Submission #443081

# Submission time Handle Problem Language Result Execution time Memory
443081 2021-07-09T15:43:50 Z benedict0724 Fountain Parks (IOI21_parks) C++17
Compilation error
0 ms 0 KB
for(int i=0;i<n;i++) link[i] = i;
        for(int i=0;i<n;i++)
        {
            for(int j : adj[i])
            {
                if(y[i] < y[j])
                {
                    u.push_back(i);
                    v.push_back(j);
                    b.push_back(y[i] + 1);
                    if(x[i] == 2 || (x[i] == 4 && y[i]%4 == 0))
                    {
                        a.push_back(x[i] - 1);
                        M2[{x[i]-1,y[i]+1}] = 1;
                    }
 
                    else
                    {
                        a.push_back(x[i] + 1);
                        M2[{x[i]+1, y[i]+1}] = 1;
                    }
 
                    _unite(i, j);
                }
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j : adj[i])
            {
                if(_find(i) == _find(j)) continue;
                if(x[i] > x[j]) swap(i, j);
                u.push_back(i);
                v.push_back(j);
                a.push_back(x[i] + 1);
                if(M2[{x[i] + 1, y[i] + 1}]) b.push_back(y[i] - 1);
                else b.push_back(y[i] + 1);
 
                _unite(i, j);
            }
        }
 
        if(CC < n-1) return 2;
        build(u, v, a, b);
        return 1;

Compilation message

parks.cpp:1:1: error: expected unqualified-id before 'for'
    1 | for(int i=0;i<n;i++) link[i] = i;
      | ^~~
parks.cpp:1:13: error: 'i' does not name a type
    1 | for(int i=0;i<n;i++) link[i] = i;
      |             ^
parks.cpp:1:17: error: 'i' does not name a type
    1 | for(int i=0;i<n;i++) link[i] = i;
      |                 ^
parks.cpp:2:9: error: expected unqualified-id before 'for'
    2 |         for(int i=0;i<n;i++)
      |         ^~~
parks.cpp:2:21: error: 'i' does not name a type
    2 |         for(int i=0;i<n;i++)
      |                     ^
parks.cpp:2:25: error: 'i' does not name a type
    2 |         for(int i=0;i<n;i++)
      |                         ^
parks.cpp:27:9: error: expected unqualified-id before 'for'
   27 |         for(int i=0;i<n;i++)
      |         ^~~
parks.cpp:27:21: error: 'i' does not name a type
   27 |         for(int i=0;i<n;i++)
      |                     ^
parks.cpp:27:25: error: 'i' does not name a type
   27 |         for(int i=0;i<n;i++)
      |                         ^
parks.cpp:43:9: error: expected unqualified-id before 'if'
   43 |         if(CC < n-1) return 2;
      |         ^~
parks.cpp:44:14: error: expected constructor, destructor, or type conversion before '(' token
   44 |         build(u, v, a, b);
      |              ^
parks.cpp:45:9: error: expected unqualified-id before 'return'
   45 |         return 1;
      |         ^~~~~~